Open ajmas opened 6 years ago
Cannot reproduce with either fenced block or indented block.
Turns out It was an incomplete scenario. It happens when it is a child of a bullet list:
Also an issue in master branch version. GitHub editor renders fine:
Get details on campaign
GET /api/campaign/:id
{
"id": "",
"name": "",
"ref": "",
"description": ""
"nodes": [{
}]
]
That's a great example. It seems like Hoedown assumes that indentation level is 4; in your example, if the code block is indented with four spaces, it will show just fine.
However, we are planning to move to CommonMark, where it is clearly defined that this is not desired, and your case should be correctly recognized as indentation with two spaces. In conclusion, this is a bug, but need some time to fix.
I'm not sure if I'm seeing the same thing or if it's the same bug, but I'm seeing fenced code blocks not respecting whitespace at all when they're children of a bulleted list.
If this is the same issue then I won't open another, and it sure seems like it might be.
@cori Does the fenced code belong to the item or not? I meant, what you intend to do?
Ideally (for me in this case) it would be a part of that bullet, but would display formatted
Then you should indent the fenced code block, or the parser would got confused.
same result when indented 4 spaces:
here's the actual content
{
"prop1": "thing1",
"prop2": "thing2",
"obj_prop": {
"oprop1": "othing1",
"oprop2": "othing2"
}
}
{
"prop1": "thing1",
"prop2": "thing2",
"obj_prop": {
"oprop1": "othing1",
"oprop2": "othing2"
}
}
You need a blank line between the code block and everything else. Your sample is same as
a line
{ "some": "code" }
within a list item. The code above renders the “fenced block” as inline block, since there is no empty line to break the paragraph “a line”.
I’m not sure whether this meet the requirement of CommonMark, but it is a good habit anyway. I’ll further investigate the CommonMark specification.
Oops, looks like CommonMark allows this:
Fenced code blocks can interrupt paragraphs, and can be followed directly by paragraphs, without a blank line between…
But that’s another bug.
Yeah CommonMark is more lenient with empty lines. The produced HTML is the same, however, since <pre>
is a block-level element, and cannot be nested inside <p>
. I would recommend users to add an empty line anyway. There’s no such thing as a code block belonging to a paragraph.
The develop
branch of Hoedown has it right again. So we are back to the old issue #704. That one is blocking. I think it’s better to write well-formed Markdown instead of trying the edge-cases, until we find a better Markdown implementation.
I have the following Markdown code:
This formats correctly in GitHub issue tracker, but not in Macdown. The attached image illustrates the behaviour
MacDown 0.7.1, macOS 10.13.1