adamerose / vscode-markdown-wysiwyg

https://marketplace.visualstudio.com/items?itemName=adamerose.markdown-wysiwyg
Other
14 stars 4 forks source link

Prevent special characters being escaped #4

Open manchuwook opened 1 year ago

manchuwook commented 1 year ago

Hi, I really love your extension, and it has been a HUGE timesaver.. but the one thing I wish there were an option was not to have it auto-escape stuff in the front matter of MD files. For example, I have it added at the top (like you do) and change the formatting later in the document. It then adds a backslash to [ and ] symbols and stuff to underscores.

I don't know if some linter does it or what, but ideally, if you can't have it detect front matter, could I at least turn off the auto-escape?

manchuwook commented 1 year ago

As an example, it would look like this in the text editor

---
title: "Lorem ipsum"
description: "Quod numquat demonstratum"
showHero: true
heroStyle: "background"
date: "2023-03-06T12:00:00"
series: [ "Lore" ]
categories: [ "Lore", "Background", "Story" ]
tags: [ "Lore", "Background", "Story" ]
series_order: 1
---

But then it would make it into \["Lore"\] and series\_order: 1 after I add a new paragraph or change something to bold.

adamerose commented 1 year ago

Hi @manchuwook I'm glad you like the extension. In your title you mentioned Huge Front Matter which I've never used, but the docs seem to mention yaml, toml, and json but not markdown. How does that tool involve markdown?

The problem is caused when CKEditor5 converts the WYSIWYG editor contents to markdown it escapes special characters. I see the same behavior when I paste your snippet here.

Fixing this is out of scope of this extension and should be done upstream with an issue on CKEditor5. Are there any characters you found other than [, ], and _ that get unnecessarily escaped?

manchuwook commented 1 year ago

Just those 3

adamerose commented 1 year ago

Created an upstream issue https://www.github.com/ckeditor/ckeditor5/issues/13757