snudown icon indicating copy to clipboard operation
snudown copied to clipboard

Enable codefence markdown extension

Open empyrical opened this issue 6 years ago • 3 comments

This pull request enables the GitHub-style markdown codefences in Snudown (by enabling the MKDEXT_FENCED_CODE flag)

So, if merged, code blocks like this will work on the old reddit design:

```javascript import leftpad from "left-pad"; ```

This also modifies the generated codeblocks somewhat. Previously, it would have a <pre> with a class like this:

<code class="javascript">

Where the class is any un-namespaced user-provided css class, which may not be desirable.

I tweaked it to be like this instead:

<code class="md-code-language-javascript">

So it is namespaced, but still gives people making stylesheets or someone making a browser extension something to work with for determining the language of the code block.

empyrical avatar Nov 18 '18 19:11 empyrical

Yes please this would help out nearly every programming community on reddit as well as some math and science heavy ones.

13steinj avatar Nov 29 '18 15:11 13steinj

Thanks for the effort, but reddit is not using this markdown parser any more. We're now using a modified comrak parser because, among other reasons, this codebase repeatedly failed fuzz testing.

pwildani avatar Nov 29 '18 17:11 pwildani

@pwildani It is still used on old reddit, and the fact old reddit doesn't have codefences while new reddit does is a major point of awkwardness for users.

empyrical avatar Nov 29 '18 21:11 empyrical