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

[Markdown] Markdown components (MDC) syntax support #13512

Open
6r1d opened this issue Sep 23, 2022 · 4 comments
Open

[Markdown] Markdown components (MDC) syntax support #13512

6r1d opened this issue Sep 23, 2022 · 4 comments
Labels
lang:markdown Issues affecting Markdown status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@6r1d
Copy link

6r1d commented Sep 23, 2022

Hello.

It would help a lot if Prettier had a config option to support Markdown component syntax. In a scenario Prettier is used for CI to prevent the merging of the documentation that was not formatted, having any support for MDC would allow to use custom widgets in the documentation.

Currently, Prettier will break the formatting inside such a component so that newlines are replaced by the white spaces.

As an example, such configuration is used in Iroha 2 docs: package.json, integration step.

Thanks.

@thorn0 thorn0 added type:enhancement A potential new feature to be added, or an improvement to how we print something status:needs discussion Issues needing discussion and a decision to be made before action can be taken lang:markdown Issues affecting Markdown labels Sep 23, 2022
@kachkaev
Copy link
Member

kachkaev commented Dec 10, 2022

@piet-maier has provided an example of MDC syntax in #13512 #13963, if anyone needs it.

@cyrilf
Copy link

cyrilf commented Dec 28, 2022

@kachkaev I think you meant this playground example from this issue #13963

@fkrauthan
Copy link

I would also be interested in this. There seem to be a more advanced proposal here https://talk.commonmark.org/t/generic-directives-plugins-syntax/444 with a generic directives syntax (that also includes the MDC syntax). Based on some small code research it seems like the only thing that needs to change is https://github.com/prettier/prettier/blob/main/src/language-markdown/printer-markdown.js#L131C17-L131C48 to expand that regex if a line starts with ^:[:A-Za-z] to always set preserve?

rmarkdown also seem to support a syntax like that (https://bookdown.org/yihui/rmarkdown-cookbook/multi-column.html) for multi column support.

@angrybacon
Copy link

angrybacon commented Apr 24, 2024

It's been some time since I've had to deal with this issue in Markdown with custom directive myself and ended up here as I searched to know whether that was a known issue.

Here is a playground for reproduction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:markdown Issues affecting Markdown status:needs discussion Issues needing discussion and a decision to be made before action can be taken type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

No branches or pull requests

6 participants