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

Closed
apfelbox opened this Issue May 1, 2014 · 13 comments

Comments

Projects
None yet
4 participants
@apfelbox

apfelbox commented May 1, 2014

Hi,

currently fenced code blocks just translate the language (if given) directly into the class:

```javascript
content
```

produces:

<pre><code class="javascript">content</code></pre>

According to the HMTL5 spec, the recommended way to markup code with a "language-" prefixed class:

<pre><code class="language-javascript">content</code></pre>

I think Ghost should follow the spec here.

@apfelbox

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox May 1, 2014

Bonus feature: you'll get integration with tools - which build on the spec - for free. For example prism.

apfelbox commented May 1, 2014

Bonus feature: you'll get integration with tools - which build on the spec - for free. For example prism.

@ErisDS

This comment has been minimized.

Show comment
Hide comment
@ErisDS

ErisDS May 1, 2014

Member

Hi @apfelbox I appreciate your point. I ran into this myself with prism on hannah.wf and worked around it by using:

```language-javascript
content

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.

Member

ErisDS commented May 1, 2014

Hi @apfelbox I appreciate your point. I ran into this myself with prism on hannah.wf and worked around it by using:

```language-javascript
content

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.

@ErisDS ErisDS added bug labels May 1, 2014

@ErisDS ErisDS added this to the 0.7 Editor milestone May 1, 2014

@apfelbox

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox May 2, 2014

Hi @ErisDS, thanks for your response. Yeah, I also thought about the language-javascript workaround, but it would be nice if it would adapt to other libraries in the long run.

Is the markdown compiler a separate project or is directly from/for Ghost?

apfelbox commented May 2, 2014

Hi @ErisDS, thanks for your response. Yeah, I also thought about the language-javascript workaround, but it would be nice if it would adapt to other libraries in the long run.

Is the markdown compiler a separate project or is directly from/for Ghost?

@ErisDS

This comment has been minimized.

Show comment
Hide comment
@ErisDS

ErisDS May 2, 2014

Member

@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.

Member

ErisDS commented May 2, 2014

@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

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox May 3, 2014

@ErisDS what's with pagedown? That's what StackEdit and StackOverflow use and it seems to work reasonably well.
The synchronised scrolling of markdown and rendered content works very good on StackEdit, for example (it seems quite a bit off on OS X & Chrome currently).

apfelbox commented May 3, 2014

@ErisDS what's with pagedown? That's what StackEdit and StackOverflow use and it seems to work reasonably well.
The synchronised scrolling of markdown and rendered content works very good on StackEdit, for example (it seems quite a bit off on OS X & Chrome currently).

@ErisDS

This comment has been minimized.

Show comment
Hide comment
@ErisDS

ErisDS May 4, 2014

Member

@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.

Member

ErisDS commented May 4, 2014

@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.

@apfelbox

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox May 5, 2014

@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!

apfelbox commented May 5, 2014

@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!

@shindakun

This comment has been minimized.

Show comment
Hide comment
@shindakun

shindakun May 9, 2014

Member

@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.

Member

shindakun commented May 9, 2014

@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 ErisDS modified the milestones: 0.7 Editor, 0.5.x Feature Release Aug 16, 2014

@ErisDS ErisDS self-assigned this Aug 16, 2014

@halfdan

This comment has been minimized.

Show comment
Hide comment
@halfdan

halfdan Sep 3, 2014

Member

@ErisDS This is merged on your version of showdown - it would need an update/release and update on package.json, right?

Member

halfdan commented Sep 3, 2014

@ErisDS This is merged on your version of showdown - it would need an update/release and update on package.json, right?

@ErisDS

This comment has been minimized.

Show comment
Hide comment
@ErisDS

ErisDS Sep 4, 2014

Member

Yep, that's why it's assigned to me 😉

Member

ErisDS commented Sep 4, 2014

Yep, that's why it's assigned to me 😉

@halfdan

This comment has been minimized.

Show comment
Hide comment
Member

halfdan commented Sep 4, 2014

@apfelbox

This comment has been minimized.

Show comment
Hide comment

apfelbox commented Sep 22, 2014

@apfelbox

This comment has been minimized.

Show comment
Hide comment
@apfelbox

apfelbox Sep 22, 2014

PS: this is now merged in CommonMark (new name of "standard markdown"): http://jgm.github.io/stmd/spec.html#example-81

apfelbox commented Sep 22, 2014

PS: this is now merged in CommonMark (new name of "standard markdown"): http://jgm.github.io/stmd/spec.html#example-81

ErisDS added a commit to ErisDS/Ghost that referenced this issue Sep 24, 2014

ErisDS added a commit to ErisDS/showdown that referenced this issue Nov 15, 2014

Fenced code blocks should use "language-*" classes
- Fenced code updated to include -language-' if not supplied.
- Ref: TryGhost/Ghost#2675

ErisDS added a commit to ErisDS/Ghost that referenced this issue Nov 15, 2014

Update showdown to showdown-ghost 0.3.4
closes #2675

- update showdown to the newly published showdown-ghost module which has a fix for the lack of language support in codeblocks

@jaswilli jaswilli closed this in #4458 Nov 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment