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

The other heading style #51

Open
istathar opened this issue Jun 6, 2018 · 2 comments
Open

The other heading style #51

istathar opened this issue Jun 6, 2018 · 2 comments

Comments

@istathar
Copy link

istathar commented Jun 6, 2018

I have a significant corpus of material that uses the original Markdown syntax for headings ("setext style, I think?) with

Level 1
=======

and

Level 2
-------

headings. We value these for the visual strength and structural separation they give when scanning the original text documents. I like the goals you set out for mmark but I'd need to contribute to enable support for these if I was to use this for real. Do you think this would be possible with the code as currently designed?

AfC

@mrkkrp
Copy link
Member

mrkkrp commented Jun 6, 2018

Yes, that's setext headings. As I state here

Setext headings are not supported for the sake of simplicity.

If we're to support this style of headings, it'll considerably complicate parsing of paragraphs because headings can interrupt paragraphs so we'd need to constantly check following line if it has === or --- and if the line we're grabbing can thus be interpreted as a header.

I don't remember exactly though, you'll need to check the spec. But I left them out for a reason, I think. You're free to try to add them, just keep an eye on bencmarks too. Be careful with paragraph parsing because it's about 80-90% of real-world input and so it's a major performance bottleneck.

@mrkkrp
Copy link
Member

mrkkrp commented Jun 6, 2018

Actually may be quite doable. The interesting feature is this:

https://spec.commonmark.org/0.28/#example-51

So we could perhaps just check if a paragraph ends with such "header line" and then decide what we've parsed accordingly. Will need to try to conform to as many examples from the spec as possible.

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

2 participants