Skip to content

Formal specification for extensions beyond "standard" Markdown #1482

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

Closed
srawlins opened this issue Sep 5, 2015 · 2 comments
Closed

Formal specification for extensions beyond "standard" Markdown #1482

srawlins opened this issue Sep 5, 2015 · 2 comments

Comments

@srawlins
Copy link
Member

srawlins commented Sep 5, 2015

This markdown package currently supports one non-standard syntax (the code fence), and there are open issues requesting support for more (see #1466, dart-lang/markdown#38, dart-lang/markdown#41, and dart-archive/markdown#31). It's of course up to the maintainers whether to include any more non-standard syntaxes beyond code fences, but the none of these issues has been outright rejected.

When syntax extensions are supported in a Markdown parser, they should be able to be toggled, to reduce surprises (see Pandoc, Redcarpet, and others). This is the primary reason for having a formal specification: this package shouldn't format a user's Markdown strangely because it chose to include one certain non-standard syntax, and to always include it.

I propose a new argument to markdownToHtml() and new Document(), perhaps List<String> extensions. This argument defaults to []. The different values might include:

I realize that this package already supports user-written, inline syntax extensions per-document, but supporting user-written block syntaxes would be very hard, as they would want access to the different private patterns, etc (for example how ListSyntax uses all the other block syntax patterns to see whats up). So if this opens the door to non-standard block syntaxes like tables, and definition lists, then its a super win.

This new argument also eases some anxiety of adding a new syntax extension: it will always be safely disabled by default, and only enabled when the user chooses to use it.

If y'all like the idea, I'm happy to send a PR adding the argument, and disabling the FencedCodeBlockSyntax by default.

@munificent
Copy link
Member

Yeah, this is a good idea. There are other structural changes I'd like to do in the package, but my time to work on it is really limited right now. How about we leave this bug open for now and if I get some time to modernize the package overall, we'll do it then?

@srawlins
Copy link
Member Author

srawlins commented Sep 7, 2015

Hey @munificent ,

I just sent a PR for this formalization. If you have concrete ideas for the structural changes you want to make, could you open an issue? I might have time for it.

In any case, can we accept the formalization before the restructuring?

@mosuem mosuem transferred this issue from dart-archive/markdown Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants