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

Closed
pawamoy opened this issue Apr 14, 2024 · 2 comments
Closed

On/off comments #436

pawamoy opened this issue Apr 14, 2024 · 2 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
@hukkin
Copy link
Owner

hukkin commented Aug 9, 2024

Hi!
This seems like a dupe of #53 so closing. This feature is very welcome, but behavior should be well defined. I had some concerns: #53 (comment)

Might be good to spec out the corner cases prior to actual implementation.

@hukkin hukkin closed this as completed Aug 9, 2024
@pawamoy
Copy link
Author

pawamoy commented Aug 10, 2024

Ah, sorry for missing #53! Will continue discussion there, thanks 🙂

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

2 participants