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

GFM: How to include code for a fenced code block inside a fenced code block? #456

Closed
LeaVerou opened this issue Nov 8, 2017 · 4 comments
Assignees

Comments

@LeaVerou
Copy link

LeaVerou commented Nov 8, 2017

The GFM spec includes multiple strategies for this, none of which seem to work with Showdown.

  • "The closing code fence must use the same character as the opening fence:": Tildes don't seem to be supported
  • "The closing code fence must be at least as long as the opening fence": Using more than three backticks doesn't seem to be supported
  • I tried backslash escaping, that didn't work either.

Is there any way to do this?

(code below for attempt number 2: using different number of backticks)

## Demo

````markup
<div mv-app mv-storage="local" 
     mv-plugins="markdown">
	<div property="text" class="markdown">### Heading
**This is bold** *This is italic* 
Here’s a [link!](https://mavo.io)

And some code:

```js
	foo.bar();
```
	</div>
</div>
````
@tivie tivie self-assigned this Nov 9, 2017
@tivie
Copy link
Member

tivie commented Nov 9, 2017

Tilde fenced blocks is, indeed, a feature implemented (not so) recently in github that is missing from showdown. I will implement it in the next showdown release.

Currently there is no way to include code for a fenced code block inside a fenced code block.

But meanwhile, you can include code for a fenced code block inside an indented code block*, like so:

    ```markup
    <div mv-app mv-storage="local" mv-plugins="markdown">
    <div property="text" class="markdown">### Heading
    **This is bold** *This is italic* 
    Here’s a [link!](https://mavo.io)

    And some code:

        ```js
        foo.bar();
        ```
	</div>
    </div>
    ```

@LeaVerou
Copy link
Author

LeaVerou commented Nov 9, 2017

But there's no way to provide a language tag for an indented code block, right?

@tivie
Copy link
Member

tivie commented Nov 11, 2017

@LeaVerou right

@tivie
Copy link
Member

tivie commented Nov 11, 2017

Should be fixed now (c956ede) (version 1.8.2)


As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money. Currently, we're looking to improve showdown with automated tests in all browsers and a proper domain and webpage. 500$ should be enough to to keep showdown testing framework running for a year or two.

If you like our work and find our library useful, please donate through Pledgie or directly through paypal!! Your contribution will be greatly appreciated.

@tivie tivie closed this as completed in c956ede Nov 11, 2017
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