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

On/off comments #436

Open
pawamoy opened this issue Apr 14, 2024 · 0 comments
Open

On/off comments #436

pawamoy opened this issue Apr 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@pawamoy
Copy link

pawamoy commented Apr 14, 2024

Context

I'm evaluating mdformat in one of my projects (actually my MkDocs-based website).

It's super useful already, but obviously there are some incompatibilities between the parser used by mdformat and the one used by MkDocs (Python-Markdown). I don't mind these incompatibilities, and would actually like to write plugins myself to support Python-Markdown extensions 🙂 (if it's at all possible 🤔?)

In the meantime, it would be great if I could add on/off comments to my Markdown document to prevent mdformat from formatting some snippets. Typically, mkdocstrings instructions that look like this:

::: path.to.object
    options:
      show_source: false

...and get reformatted like this:

::: path.to.object options: show_source: false

Proposal

I would suggest supporting on/off comments like the following:

<!-- mdformat: off -->

::: path.to.object
    options:
      show_source: false

<!-- mdformat: on -->

I have implemented the same thing for blacken-docs (though still waiting review), so could probably send a PR to mdformat too, if this feature is something you'd like to have 🙂

Tasks and updates

No response

@pawamoy pawamoy added the enhancement New feature or request label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant