Markdown question: retyping space after header hashtags

Hey MPU folk. I hope you are staying calm during these strange days.

This is a (multi)markdown question (so strictly not MacOS/iOS related) and am hoping someone might know why it happens (or even says “yeah, that’s a thing”).

It seems common across different text editing software that if I type a heading hashtag, then a space and then the title that the software won’t recognise that as a header, UNLESS I go back and delete the space and re-add it. Then, all works fine. By ‘recognise’ I mean if I were to preview the markdown in Marked, or through Pandoc (to create a PDF or docx, etc). I’ve tried just not adding the space between the hashtag and the text but have even more flakey outcomes.

Here’s a very short screencast of the behaviour (working with ST3 and Marked2):

https://v.usetapes.com/b0fvVq73Bu

This happens pretty much all the time. Am mostly working in Sublime Text, but also nvUltra, Byword, iA Writer, etc.

Thanks all.
Sending lockdown love from london.
Simon

I’m using Visual Studio Code as my markdown editor and have not seen that issue. I don’t recall if it happened in Drafts, but I haven’t been actively using it lately.

My practice is not to leave spaces between the hash and text. Ulysses, my main editor, accepts a space and still obeys the Markdown. You say you get the problem even if you don’t leave a space. I think the problem could be the way you are making paragraphs or not making them rather? I would try that. I think you are doing something with the delete or return keys which you unwittingly correct when you go back over it. Does that make sense. I had a problem one time because I had the habit of using Shift + Return rather than just Return for example.

1 Like

Does a newline after the heading text trigger recognition? (It does for me - with e.g. Drafts.)

And I always have a space between the heading symbols (o to thorpe, hash, pound (ugh)) and the heading text. In my case I use TextExpander snippets with fill-ins for headings, including trailing new lines.

2 Likes

That made me think again actually about using snippets for these. Consistency is the key I have found. I am sure, as you suggest, Simon’s problem is ‘newline’ and something he is doing with that not the heading Markdown. I don’t quite understand how it works really, I just do it by muscle memory now. Good advice though re using expansions and they can be useful for reasons beyond speed. Consistency mainly?

The other thing about snippets is they needn’t expand to e.g. three octothorpes/hashes/pounds. They could expand to arbitrary HTML - which any decent Markdown processor could handle. So anchors with CSS etc become possible.

1 Like