Marked is wrongfully interpreting text as code blocks
Marked 2 (Setapp version 2.5.31 (971)) seems to interpret textual content as code blocks in some cases. For e.g., in the markdown content specified below, the text "Text explaining sub-heading 3" is rendered as a code block, complete with code theming.
Heading 1
Heading 2
- ### Sub-heading 3 Text explaining sub-heading 3
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 02 Mar, 2019 12:53 PM
Text indented 4 spaces or one tab is code, that's universal Markdown syntax. Remove the leading spaces and it will function as you're expecting.
- Brett
2 Posted by Adi on 03 Mar, 2019 01:13 AM
Thanks! I was not aware of that. I was under the impression code blocks were the only way to express code.
3 Posted by Adi on 11 Mar, 2019 11:39 PM
A follow up. Please see attached file for context. Is there any way to get indentation in Markdown given that text indented by a tab or 4 spaces is code? The attached file is rendered "correctly" by Ulysses's HTML preview but is rendered differently by Marked.
Support Staff 4 Posted by Brett on 12 Mar, 2019 12:38 AM
You have double indentations on all of those list items. They should
only be indented one tab unless you actually want them to be code. I
have no idea why Ulysses is allowing that, but doing it correctly should
work in both cases.
- Brett
5 Posted by Adi on 12 Mar, 2019 01:52 PM
Thanks Brett.
Just to clarify, those double indentations are a result of having nested lists. They are not put in by me but rather an artifact of creating nested lists in Ulysses.
Even though Ulysses is not following Markdown spec, it's rendering is more intuitive IMO. Although, I figure it severely impacts the portability of the Markdown document itself.
Support Staff 6 Posted by Brett on 12 Mar, 2019 01:55 PM
What method are you using to preview? Creating an indented list in
Ulysses follows standard Markdown rules for me (and works perfectly with
Marked).
- Brett
7 Posted by Adi on 12 Mar, 2019 02:51 PM
I am use the shortcut within Ulysses to generate a HTML preview: apple + shift + P
Re-reading my previous post, I think I might have misspoke. To create an indented list, I do use the
Tab
key. However, I do not use theTab
key for the first level list.For e.g., in the file attached previously (Demo.md), I only use the
Tab
key to indent the second level list item that says "Second sub-heading's sub-heading" .As the previews shows, Ulysses interprets it as per my intention: a 3rd level heading and a second level list item. Marked, however, interprets it as a code block.
Support Staff 8 Posted by Brett on 12 Mar, 2019 03:01 PM
Ok, I take back my comment about double-indentation, the preview I was looking at was displaying tabs double-width, your syntax for that was actually fine. The problem is that Markdown doesn't allow headings within list items. Ulysses might, but that's never going to be interpreted correctly in most Markdown applications.
You also need to make a habit of putting a blank line between paragraphs within a list item. As you'll see below, the right whitespace provides the correct result, sans the headings. I'm not sure why you need indented headings, but you might consider just using bold text instead. In my experience outlines in list format don't have embedded headings, but either way, it's not something regular Markdown is going to allow.
Here's a revision of your text that works:
9 Posted by Adi on 13 Mar, 2019 02:41 PM
That explains it. Thanks Brett.