elliotblackburn / mdpdf

Markdown to PDF command line app with support for stylesheets
https://npmjs.com/package/mdpdf
Apache License 2.0
691 stars 45 forks source link

Add cli parameter to set details tabs open by default #184

Open lvlcn-t opened 3 months ago

lvlcn-t commented 3 months ago

Issue

When running the normal mdpdf <source> <destination> [options] command, the generated pdf file will not have the details tabs open by default if the open attribute is not set on the details tags.

Problem Description

Some may want to have the details tabs open when generating the pdf file, but the current implementation does not allow for this without a manual change to the markdown file.

Solution Proposal

Add a new cli parameter to the mdpdf command that will allow the user to specify that the details tabs should be open by default when generating the pdf file. I'm no expert in javascript and haven't looked at the code, but I think you could iterate over the details tags and set the open attribute to true if the new cli parameter is set.

Additional Context

To reproduce the issue, create a markdown file with the following content:

# Test

<details>
  <summary>Click me</summary>
  I'm open by default
</details>
mdpdf test.md test.pdf

The generated pdf file will have the details tab closed by default.