Next Version of Markdown Field

Hey fans of Markdown,

I’ve been working on the next iteration of The Markdown Field plugin over the last months. It will be based on CodeMirror 6 instead of CodeMirror 5. Why is this great news? CM6 has much improved support for touch devices, such as the iPad and features and should resolve (most of) the performance issues, which have been present in version 1.

Although we now have great WYSIWYG capabilities built into Kirby, I still use Markdown/Kirbytext quite a lot, when it comes to technical documentation, knowledge management and blogging. I.e. everywhere, where dealing with large amounts of text, lots of links is more important, than having a sophisticated layout with lots of complicated blocks. The cool thing is, that the new version also comes with an enhanced Markdown block for Kirby’s blocks field, so you can mix the best of both worlds. :slight_smile: And even cooler, the new plugin allows you to extend the syntax highlighting and even define your own dialogs for your custom toolbar buttons.

The current state (late alpha/early beta) can be found at: GitHub - sylvainjule/kirby-markdown-field at next

The reason for this early announcement is, that I ran into a few edge cases with nested formats, when toggling overlapping inline formats, such as bold (**bold**) and italic (*italic*) texts. In these cases, Parsedown (Kirby’s Markdown Parser) fails to recognize these correctly, but the editor’s parser interprets them correctly. Example:

wo*rd **wo*****rd word**
should become:
wo<em>rd <strong>wo</strong></em><strong>rd word</strong>

But Parsedown is able to handle it correctly, when using the underscore _ character for italic text instead:

wo_rd **wo**_**rd word** (works fine)

I now have to make a decision, whether the editor will use the asterisk * for marking italic text or if it will use *. I personally tend to use the asterisks for both bold and italic text, but Markdown theoretically supports both. This is truly an edge-case, but I still need to make a decision now. The editor has to settle on one character for marking up italic text, when you press the “I”-Button or hit the corresponding keyboard shortcut.

Please answer the poll and feel free to leave some early feedback in this thread.

Which syntax do you prefer?
  • *italic*
  • _italic_
  • Don’t care

0 voters

1 Like


Well there was an issue I kept bumping using the Markdown Field plugin: if I would have to add a link with the target: _blank attribute then it would cause the content after to be previewed in italics although it is not, which is slightly annoying.

Would using _italics_ make situations in which one uses a target: _blank problematic or that has been taken into account?

I use the Markdown Field for almost every project and I’d be eager to see its next iteration. Thanks!

Can you give me some example input? CodeMirror 6 has a new parser, that deals a bit better with that. So only _italic_ would cause something to be highlighted. But Kirbytags-Highlighting – unfortunately – cannot happen on parser-level without investing much more work. So it is still possible to fool the parser, but it should still be much more reliable.

1 Like

That was an issue I bumped on Sylvain Julé’s iteration and haven’t tested your beta version: if the current parser you’re using is harder to fool then that’s great news. I should check out.

Okay, it seems that _italic has won. If will proceed with that syntax from now on, when you hit the toolbar button or the keyboard shortcut. Thanks for all of your feedback. :smiley: