microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.07k stars 6.48k forks source link

HTML <details> tab breaks markdown preview #4358

Open boardtc opened 4 years ago

boardtc commented 4 years ago

Adding collapsible section in markdown using html details tag is not supported and all of the embedded markdown in the details tag is shows as is:

Use HTML tag details \

< summary >Click to expand!< /summary >

  ## Add collapsible section
  1. All of this is shown
  2.  with 
     * no line breaks 
     * or rendering
</ details>
crutkas commented 4 years ago

can you provide a file we can test against?

boardtc commented 4 years ago

Not sure why you don't allow markdown files to be attached, here's it zipped. tester.zip Here's what the preview of it looks like tester preview

crutkas commented 4 years ago

copy of MD. VS Code previews this correctly.

# heading 1

* Departure so attention pronounce satisfied daughters am. But shy tedious pressed studied opinion entered windows off. Advantage 
* dependent suspicion convinced provision him yet. Timed balls match at by rooms we. Fat not boy neat left had with past here call. 
* Court nay merit few nor party learn. Why our year her eyes know even how. Mr immediate remaining conveying allowance do or. 

# A collapsible section with markdown
<details>
  <summary>Click to expand!</summary>

## Heading 2
  1. A numbered
  2. list
     * With some
     * Sub bullets
</details>
franky920920 commented 2 years ago

Will shifting md preview to monaco resolve this?

crutkas commented 2 years ago

No since we his is about rendering, Monaco is about viewing

Jay-o-Way commented 2 years ago

Is this still an issue with the latest version?

boardtc commented 2 years ago

I just tested and it's the same.... on current

Jay-o-Way commented 2 years ago

Don't think this is an issue with the actual plug-in, because there is the same result using \

in comments like this one:

Source text - note the empty lines:

<details><summary>This does not work</summary>
This list:
- contains items
- that will not be
- correctly displayed
</details>
<details><summary>This does work</summary>

This list:
- contains items
- that **will** be
- correctly displayed
</details>

Result

This does not work This list: - contains items - that will not be - correctly displayed
This does work This list: - contains items - that **will** be - correctly displayed
Jay-o-Way commented 2 years ago

@Aaron-Junker do you know anything about the markdown engine?

crutkas commented 2 years ago

It is the parsing engine plugin we use. We may be able to swap it out for something else but end of day, the primary goal is to help you see what is in the file, not be a perfect render.

Jay-o-Way commented 2 years ago

@crutkas I agree on the (low) priority. But do you know why Github Markdown shows the exact same thing?

crutkas commented 2 years ago

Cause they control the parser and rendering :). They can do whatever they want since they control all aspects of how things are interpreted and converted to HTML

Jay-o-Way commented 2 years ago

Actually, it's literally mentioned here: https://gist.github.com/scmx/eca72d44afee0113ceb0349dd54a84a2#code 🤓 and here https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d @boardtc looks like you simply need to re-write a bit - the first blank line after closing tag </summary> is the crucial one

boardtc commented 2 years ago

Hmmm... I took the sub-heading out and tried the following with the same result, don't think I missed anything? md

Jay-o-Way commented 2 years ago

Hmmm... I took the sub-heading out and tried the following with the same result, don't think I missed anything?

Only thing I can think of is the amount of spaces.

1. Item
   * Item
boardtc commented 2 years ago

I increased from 2 to 4, it makes no difference :-(

Jay-o-Way commented 2 years ago

I increased from 2 to 4, it makes no difference :-(

And 3? The general rule it's that the position of the * must align with the first character of the previous list item.

boardtc commented 2 years ago

Since you asked I tested that but the bug is not down to the spaces