typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 56 forks source link

[Feature] properly support <details> #5959

Open Pomax opened 9 months ago

Pomax commented 9 months ago

1.8.6 came with updates for GitHub flavoured markdown, but ever since Typora got released, the <details> solution for collapsible sections as officially advocated by github themselves hasn't been (properly) supported.

The linked document shows exactly how it's supposed to work, so... can we please get Typora to do what GitHub does, when writing GFM, ideally in the next minor release?

(Even if you don't add full HTML support, which ideally you should, because that's officially part of GFM, at least add proper support for the details element)

Pomax commented 9 months ago

To wit, using the official GitHub specified example code:

<details>

<summary>Tips for collapsed sections</summary>

### You can add a header

You can add text within a collapsed section. 

You can add an image or a code block, too.

```ruby
   puts "Hello World"



Typora renders this:

![image](https://github.com/typora/typora-issues/assets/177243/18892994-f1cf-4559-a5f2-0e798ec49c03)

So it looks like it has some built in CSS to add the little triangle, but that's about all the support it currently has.
hsandt commented 4 months ago

Indeed, the fact that the details section is broken and the closing </details> pops up at the end also has unintended consequences, such as copying HTML trying to wrap </details> into its own <p>...</p> tags.

I use this to copy folded sections into itch.io game descriptions directly as HTML (due to the lack of Markdown editor for game descriptions), and it causes a visible </p> to appear after the folded section. I have to manually move the </p> back before </details>.