Ghost: Support fenced code block in list.

Created on 4 Aug 2015  Â·  11Comments  Â·  Source: TryGhost/Ghost

It would be great if we can do something like this:

  • A list item with some code sample

console.log('hello, world.');

bug server / core

Most helpful comment

How about this?

2016-04-11 5 02 55

Code blocks nested in blockquote are not rendered correctly. It should be a <pre><code>...</code></pre>, but in Ghost got just <code>。

Take below as example:

``````

Note:

Some code in blockquote.

function() {
  consoel.log('hello world!');
}

``````

This block is rendered to:

<blockquote>
  <p>Note:</p>

  <p>Some code in blockquote.</p>

  <p><code>javascript
  function() {
    consoel.log('hello world!');
  }
  </code></p>
</blockquote>

The correct result should be:

<blockquote>
  <p>Note:</p>

  <p>Some code in blockquote.</p>

<pre><code class="javascript language-javascript">function() {
  consoel.log('hello world!');
}</code></pre>
</blockquote>

The official demo of Showdown works well.

2016-04-11 5 11 59

Marked works well, too.

So why do not use the official version of Showdown, the Ghost fork is out of date and bugly.

All 11 comments

Why do not use marked? It should better than showdown.

:+1:

@vilic Have you found a decent workaround for this in the meantime?

@tomekr sadly no.

I think this is https://github.com/showdownjs/showdown/issues/208 and there's an easy solution.

@jgillich I can get the work around you posted to work on http://showdownjs.github.io but not in Ghost. The best I've been able to manage is:

1. item one
    ```code 1
    code 2
    ```
2. item two

Which creates what looks like a code block broken in half over two lines:
capturemd

@JohnWestlund I believe the workaround doesn't used "fenced" code blocks, rather relies on the indentation to indicate a code block. e.g.:

screen shot 2015-11-10 at 12 00 47

@kevinansfield yes, the indentation work but how do you use syntax highlight without fenced code blocks

```language-javascript [...] ```

How about this?

2016-04-11 5 02 55

Code blocks nested in blockquote are not rendered correctly. It should be a <pre><code>...</code></pre>, but in Ghost got just <code>。

Take below as example:

``````

Note:

Some code in blockquote.

function() {
  consoel.log('hello world!');
}

``````

This block is rendered to:

<blockquote>
  <p>Note:</p>

  <p>Some code in blockquote.</p>

  <p><code>javascript
  function() {
    consoel.log('hello world!');
  }
  </code></p>
</blockquote>

The correct result should be:

<blockquote>
  <p>Note:</p>

  <p>Some code in blockquote.</p>

<pre><code class="javascript language-javascript">function() {
  consoel.log('hello world!');
}</code></pre>
</blockquote>

The official demo of Showdown works well.

2016-04-11 5 11 59

Marked works well, too.

So why do not use the official version of Showdown, the Ghost fork is out of date and bugly.

I really wanna know when will this issue be fixed

need fixed + 1.

row markdown:

ghost output:

When will fenced code block be supported in Ghost? Have been waiting for this for a long long time

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HenryMarshall picture HenryMarshall  Â·  4Comments

krokofant picture krokofant  Â·  3Comments

fueko picture fueko  Â·  3Comments

marcuspoehls picture marcuspoehls  Â·  4Comments

RadoslavGatev picture RadoslavGatev  Â·  3Comments