Markdown not formatting properly
-
Hi,
I am trying to use Markdown in my post after selecting the format Markdown option in the Writing settings. However, the Markdown fails to render correctly.The blog I need help with is: (visible only to logged in users)
-
Does this help?
https://en.forums.wordpress.com/topic/markdown-doesnt-work?replies=4#post-2628722If you do not succeed type modlook into the sidebar tags on this thread for a Staff follow-up. How do I get a Moderator/Staff reply for my question? https://en.support.wordpress.com/getting-help-in-the-forums/#how-do-i-get-a-moderatorstaff-reply-for-my-question Please subscribe to this thread so you are notified when they respond and be patient while waiting. To subscribe look in the sidebar of this thread, find the subscribe to topics link and click it.
-
@timethief, sadly no. In my latest blog post, I have used the backticks to highlight inline code segments. However, when I see the post, the backticks are still present rather than rendering my post appropriately.
-
@varunagrawal , I actually see the proper code displaying in your most recent post. Did you still need help?
-
Hi supernovia,
Yes I do. If you look at my latest blog post, the section titled “Templates” has inline code with backticks which is not rendering correctly.
I also struggled tremendously with the block code, which required me to put newlines after the code block and before the ending`. And they just do not work if it is in a list. I do not face these issues in Github pages so wondering what’s up. -
I just struggled with this as well, and it just seems utterly broken. For example, the editor kept removing spaces for indentation.
When you read https://en.support.wordpress.com/markdown/ it seems that there would be a mode where you can enter Markdown not in the Visual Editor but in like a Markdown editor with no formatting. Is this something you can enable somehow, maybe?
-
-
@varunagrawal
It appears that the problem is with the list you’re using. If I remove the bullets the inline code markdown works fine, but if I add the bullets, whether via markdown or in the HTML editor the code markdown no longer works.I’ll do some more testing on this to confirm, but it looks like it might be a bug in how we handle the markdown inside lists.
-
There is no special markdown editor. You add markdown directly in the Visual editor.
If you want indentation to be preserved in your posts, you need to wrap your text in
<pre></pre>tags, otherwise extra spaces will be stripped out.Markdown won’t work for indentation, as the markdown for preformatted text is to start the line with two spaces. Any additional spaces you add for indentation will prevent the editor from recognising it as markdown, meaning the spaces will be stripped out as is the normal behaviour for the editor.
-
@kokkieh
Thanks for the reply! May I suggest that the support page I linked to above, under the paragraph “Writing with Markdown”, is updated? It was not clear to me that you would write markdown in the visual editor, rather I expected it to look something like in the image.Also, I apologize for my harsh choice of words. :)
-
Also, the paragraph “Markdown Extra and Markdown on WordPress.com” has an example on how to add syntax highlighting using Markdown. Copying and pasting that example into the visual editor embeds the CSS snippet in pre and code tags. Previewing, it has not formatted the Markdown; instead I see literal triple backticks. Removing the pre-tag will remove the indention, as you say. So I’m confused as to how that is supposed to work.
-
Copying and pasting that example into the visual editor embeds the CSS snippet in pre and code tags.
That is because you are copying the html on the support doc along with the text. That snippet was added to the support page using pre-tags, so if you highlight and copy it on the support page you’re also copying those invisible tags. The same thing happens with rich text if you copy it from a word processor.
If you first paste that text into a text editor and then copy it from there to the post editor, the pre-tags are not added. You can also the Paste as Text button in the post editor for the same effect.
It was not clear to me that you would write markdown in the visual editor, rather I expected it to look something like in the image.
The image is a side-by-side comparison of how markdown will look in the editor compared to a published post. As the purpose of markdown is to use HTML without needing to write the code I think it’s implied that one adds it to the visual editor, but we’ll look into clarifying that. Thanks for the feedback.
-
So… I’m sorry @varunagrawal for hijacking your thread, but how would I in practice use Markdown for code blocks, as the paragraph seems to say you can?
It seems to me that I either have pre-tags, and get indentation but no syntax highlighting, or I have the backticks, in which case I’ll get syntax highlighting but no indentation.
-
I guess that’s what you’re saying above. Let me in that case just suggest that you change the example that shows indented CSS wrapped in Markdown to a non-indented example, for example a simple shell script or something where this feature might make sense.
-
So you want to use indentation in code blocks? Sorry, I did not read it that way.
I did some testing and it appears that indentation doesn’t work if you create the code block with Markdown, but it does work if you use [code][/code] tags.
But there appears to be some other stuff going on with Markdown so something might be broken. I’m investigating further and will let you know once I know more.
-
- The topic ‘Markdown not formatting properly’ is closed to new replies.