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

add markdown support #2

Closed
wants to merge 4 commits into from

Conversation

lafleurdeboum
Copy link
Contributor

Adds markdown support from MDeiml's repo. There was also iyakitang's, but it wasn't updated in 3 years. Also, MDeiml's supports YAML/TOML metadata (through syntax injection I guess/hope) and Github Flavored Markdown, which is pretty widespread.

This is still WIP. I'll test the highlighter soon to check at least basic functionality.

Their README states a block and an inline grammar. Don't know how to use that ATM.

@Dav1dde
Copy link
Owner

Dav1dde commented Feb 11, 2024

@lafleurdeboum I pushed some changes to the branch, it compiles for me but I didn't test if it actually works as you'd expect.

@lafleurdeboum
Copy link
Contributor Author

lafleurdeboum commented Feb 12, 2024 via email

@lafleurdeboum
Copy link
Contributor Author

It does compile - and it fails to highlight markdown content. I pushed
a highlighter example to showcase the highlighting failure. Run with

cargo r --example=highlighter -- README.md > README.html

to see that markdown content is passed as is. Run with

cargo r --example=highlighter -- Cargo.toml > Cargo.html

to see that toml contents get highlighted, or with

cargo r --example=highlighter -- examples/highlighter.rs > 
highlighter.html

to see that rust contents also get highlighted.

BTW the example commit should be cherry-pickable for future users.
Also, cherry-picking it in #3 would show that markdown
contents do get highlighted in ikatyang's markdown parser (but if we find out how to make this one work I'd be more inclined to use it too).

@Dav1dde
Copy link
Owner

Dav1dde commented Feb 19, 2024

I fear this is just a limitation of the highlighter crate.

Thanks for adding the example, that's very useful. I don't have time to dig into this, so I am inclined to just go with #3 and if someone figures out how to use this one, we can always change it out later.

@Dav1dde
Copy link
Owner

Dav1dde commented Feb 19, 2024

Cherry picked your example into master 👍

I'll close this for now, feel free to re-open if you want to look into why it is broken (though I assume it first needs fixing in the highlighter crate).

@Dav1dde Dav1dde closed this Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants