Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ignoring specific doc sections #56

Closed
tpansino opened this issue Apr 2, 2021 · 2 comments
Closed

Support for ignoring specific doc sections #56

tpansino opened this issue Apr 2, 2021 · 2 comments
Assignees
Milestone

Comments

@tpansino
Copy link

tpansino commented Apr 2, 2021

I use terraform-docs to generate and maintain Markdown documentation for some Terraform modules, but the format of the generated tables doesn't match what this extension expects. This means that, when I run these two tools on my docs via automation, they fight each other.

Would it be possible to add support to this tool to ignore certain blocks of input? I'm thinking something similar to what prettier does:

# This should be formatted

| Column A | Column B |
|----------|----------|
| Foo      | Bar      |

# This should not be formatted

<!-- markdown-table-prettify-ignore START -->
| Column A | Column B |
|---|---|
| Foo | Bar |
<!-- markdown-table-prettify-ignore END -->

# This should be formatted again

| Column A | Column B |
|----------|----------|
| Foo      | Bar      |

FWIW I'm not a skilled JS/TS developer, but I can probably contribute something if a maintainer can give me an explanation of which components would need to be touched.

@darkriszty
Copy link
Owner

Thanks for opening the issue, I did not know about this use case 🙂 I will take a look to see how this can be added.

@darkriszty darkriszty self-assigned this Apr 2, 2021
@darkriszty
Copy link
Owner

I've added support to mark ignored sections of documents:

  • The markers are <!-- markdown-table-prettify-ignore-start --> and <!-- markdown-table-prettify-ignore-end -->.
  • Since there is no lexer or parser involved, the markers have to be precise and must be on dedicated lines, without any additional characters or text before or after.
  • If an ignore-start is in a middle of a valid table, then it will be prettyfied only up to that ignore-start. A later ignore-end in the same table will not "resume" the formatting, as the table is considered to have ended with the ignore-start.
  • The ignore-end is optional.
  • The Format Selection only considers the markers if they are inside the selection.

These changes are available in version 3.4.0 of the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants