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
Fenced code blocks should use "language-*" classes #2675
Comments
Bonus feature: you'll get integration with tools - which build on the spec - for free. For example prism. |
Hi @apfelbox I appreciate your point. I ran into this myself with prism on hannah.wf and worked around it by using:
Less than ideal, but it works! Ultimately this is a problem with the showdown library rather than with Ghost. There are a lot of wonkinesses with the markdown implementation, which we'll address in our editor overhaul project which should be Ghost v0.7 or thereabouts. |
Hi @ErisDS, thanks for your response. Yeah, I also thought about the Is the markdown compiler a separate project or is directly from/for Ghost? |
@apfelbox The markdown parser is showdown: https://github.com/coreyti/showdown, but we use my fork of it in Ghost to work around issues with new HTML5 elements: https://github.com/ErisDS/showdown Showdown is unfortunately quite buggy. There have been proposals to either fix the bugs on my fork, or to switch to another parser called marked, but both of these proposals will require a lot of time and effort, and are in my opinion not worth investing in at the present time due to the impending editor project in which overhauling the editor will be our priority. |
@apfelbox The problem with pagedown is exactly the same as with with switching to marked. It is a big project to investigate the differences, reimplement our customisations (like the image uploader) and make sure that people's content won't change in unexpected ways. This will take a lot of time and effort. We have an editor project (to do something like this) scheduled for the near future, right now we're focusing on other problems. You can see all of this info in the roadmap. |
@ErisDS thank you for your detailed answer. I will leave the ticket open but look out for the editor subproject/overhaul, so that I can possibly try to contribute it myself. Thank you so far! |
@ErisDS I ran into this due to wanting to use Prism as well, I can submit a PR on your fork of showdown if you want. |
@ErisDS This is merged on your version of showdown - it would need an update/release and update on package.json, right? |
Yep, that's why it's assigned to me |
This is now also being discussed at "Standard Markdown": http://talk.standardmarkdown.com/t/fenced-code-blocks-should-add-class-to-code-rather-than-pre-matching-the-html-best-practice/136 |
Just for the record: after the domain change, the correct URL is: http://talk.commonmark.org/t/fenced-code-blocks-should-add-class-to-code-rather-than-pre-matching-the-html-best-practice/136 |
PS: this is now merged in CommonMark (new name of "standard markdown"): http://jgm.github.io/stmd/spec.html#example-81 |
closes TryGhost#2675 - update showdown to the newly published showdown-ghost module which has a fix for the lack of language support in codeblocks
Hi,
currently fenced code blocks just translate the language (if given) directly into the class:
produces:
According to the HMTL5 spec, the recommended way to markup code with a "language-" prefixed class:
I think Ghost should follow the spec here.
The text was updated successfully, but these errors were encountered: