microsoft / vscode-markdown-tm-grammar

VS Code built-in markdown extension's Textmate grammar
MIT License
63 stars 50 forks source link

Markdown starting BOLD embedded in ITALICS renders wrongly within the editor #159

Closed JesseSteele closed 6 months ago

JesseSteele commented 6 months ago

Does this issue occur when all extensions are disabled?: Yes

Problem:

Steps to Reproduce:

  1. Copy-paste the following code block into any markdown file:
- Incorrectly rendered in the editor:

***Chocolate** and **cookies** are separate topics*
***Starting Bold** and **then more bold** in an asterisk italics line, but the entire line should appear as italics*
___Starting Bold__ and __then more bold__ in an underscore italics line, but as plain text when the line is italics_
***Starting bold** without more bold in an asterisk italics line also renders incorrectly: as bold when the line is italics*
___Starting bold__ without more bold in an underscore italics line also renders incorrectly: as plain text when the line is italics_

- Correctly rendered in the editor:

_**Chocolate** and **cookies** are separate topics_
***Chocolate* and *cookies* are separate topics** - as an asterisk bold line
__*Chocolate* and *cookies* are separate topics__ - as an underscore bold line
***Starting italics* with asterisk italics inside an asterisk bold line renders the line correctly in the editor: as a bold line**
**_Starting italics_ with underscore italics inside an asterisk bold line renders the line correctly in the editor: as a bold line**
*One **bold** word deep inside asterisk italics renders the line correctly **and sometimes bold** in the editor*
_One **bold** word deep inside underscore italics renders the line correctly **and sometimes bold** in the editor_
**A bold line *with asterisk italics deep inside* renders the line correctly *with more italics* in the editor**
**A bold line _with underscore italics deep inside_ renders the line correctly _with more italics_ in the editor**
VSCodeTriageBot commented 6 months ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.87.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

JesseSteele commented 6 months ago

It is updated to 1.87.2 and the problem persists.

JesseSteele commented 6 months ago

Comment for the PM and engineers:

The VS Code editor only renders bold OR italics, not bold AND italics. It might be easier for engineers to fix this bug as part of including a bold italics markdown class rendered inside the editor also.

...because...

Essentially this is a glitch in permutation of styling that comes from failure to recognize bold italics, then whether that bold italics is inside another bold line or inside another italics line.

Solve the permutation workflow:

  1. Identify whether a long string is plain text, bold, or italics.
  2. Recognize bold italics inside that string.
  3. Make sure this can work with multiple styled long strings on the same line.
JesseSteele commented 6 months ago

...Thanks @mjbvz Matt!

mjbvz commented 6 months ago

Duplicate of #69