simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.05k stars 133 forks source link

[TOC] and ```json ``` code sections not workign #101

Closed totalolage closed 1 year ago

totalolage commented 4 years ago

As mentioned in the title, the table of contents doesn't show up, and code sections with a language specified don't either. Furthermore the character encoding of the document doesn't seem to be being taken into account, scrambling up characters such as "č" or "ř".

totalolage commented 4 years ago

the code rendering issue seems to happen when the code doesn't match the syntax of that language. For example I'm describing an "options" object and listing the properties as such: { "property1", "property2", "property3" }, what values they can take is described in a different place in the document. This is obviously invalid syntax so it fails to render the code section.

simov commented 4 years ago

Can you paste a code snippet here that reproduces your issue(s)? You can use fenced markdown code block here.

totalolage commented 4 years ago
<h5>options</h5>
```json
{
    "conditional",
    "mandatory",
    "placeholder",
    "sequential",
    "tooltip"
}

I'm not sure how to make the closing of the json block not also close the markdown block here... here's a screenshot though

simov commented 4 years ago

You need an blank line between the HTML tag and the fenced code block.

Then the code block will be rendered. Does that solves the issue?

totalolage commented 4 years ago

Yes it does, is this the correct markdown behaviour? To break on not having a blank line? Becaue I wrote the documentation in Typora, so in that case it's a bug of Typora that it doesn't insert a line. The TOC and accented characters however still don't render (just writes out [TOC]) regardless of blank lines.

simov commented 4 years ago

Ok, can we have a separate issue for the TOC and the accented characters along with a Markdown snippet to reproduce? Thanks!

Both of the compilers officially bundled with this extension require additional blank line. No idea who's following the spec, and who's not.

I have a bunch of others compilers/parsers implemented for this extension, so you might want to try each one of them and compare the results https://github.com/simov/markdown-viewer#more-compilers

simov commented 1 year ago

Closing, feel free to create new issues with a sample markdown snippet to reproduce this.