In Markdown WYSIWYG mode, HI header in the first line is rendered as body text if it contains a colon

Hello,

I think I encountered a bug in Markdown WYSIWYG mode.

Steps to reproduce

  1. Create a Markdown document in DEVONthink.
  2. In the first line of the document, type an H1 header that contains a colon.

Expected result

The H1 header is rendered as a header, i.e. bold and bigger font size.

Actual result

The H1 header is rendered as body text, i.e. not bold and regular font size.

Screen recording

As can be seen from the recording below,

  1. The header # Title 1 test is rendered as a header.
  2. As soon as a colon is inserted, the new header # Title 1: test is rendered as body text.
  3. As soon as the new header # Title 1: test is moved from the first line to the second line, it is rendered as a header again.

Screen Recording

I suspect the problem is that the part before the colon is being treated as a metadata key. You should be able to avoid the problem by inserting a blank link before your troublesome header.

Stephen

1 Like

Thanks for the bug report, fixed for the next release.

1 Like

There’s an older threat about this phenomenon

In fact, Multimarkdown (the dialect implemented by DT/TG) uses colons in the first line to identify metadata (see MultiMarkdown User’s Guide). Personally, I find this choice a bit unfortunate, but there you are.

Markdown is not really a standard, there are many flavours, and you have work with (or around) the one provided by your tool(s).

1 Like

Hi @cgrunenberg, thank you and I do appreciate DEVONtechnology’s development team for fixing bugs so fast :smiley:

Thank you for your replies, @Stephen_C and @chrillek! When I was editing this post, the forum did suggest this post to me as potentially relevant, which reminded me of the metadata syntax in MultiMarkdown that might be related to my issue. In my case though, the troublesome headers are rendered correctly in Preview mode and the issue only occurs in WYSIWYG edit mode, which made me believe it was a bug.

But it is really useful in certain cases. :smiley:

Stephen

Possibly. I’m working with MD mostly in Hugo, and there they have metadata (“frontmatter” in their lingo) at the top of the file limited by --- on a single line, eg

---
title: "My lovely blog post"
date: 2021-11-11
---

I like that better because it is less error-prone than this “Hey, let’s just put a colon in the text when it’s on the first line” approach – this reminds me way too much of Fortran with its “Code must begin in column 7 and end not after column 72” rule.

Metadata is semantic information and it should be easily recognizable as such. But as I said, once you’ve decided (or made to) use MMD, you have to live with its benefits and disadvantages.