portive / wysimark

The Wysiwyg Editor for Markdown: 100% CommonMark + GFM with Uploads and Image Resizing
Other
239 stars 41 forks source link

Add support for collapsible sections #30

Closed LordSimal closed 3 weeks ago

LordSimal commented 1 year ago

Problem Currently this library doesn't support collapsible sections

Solution It would be awesome if this library would support collapsible sections like github does. As far as I can tell you can use the <details> HTML element to do the main part of the work here as you can see here

Use Case Something like this

<details>
  <summary>Click me</summary>

  ### Heading
  1. Foo
  2. Bar
     * Baz
     * Qux

  ### Some Code
  ```js
  function logSomething(something) {
    console.log('Something', something);
  }


could be rendered as this
![2022-11-21_15-24-34 (1)](https://user-images.githubusercontent.com/9105243/203079077-452d16b6-9749-46b0-918f-8ddb5544b097.gif)

so in our case we would have a list of staff members which have SSH keys associated to them.
This list would be rendered like

- Staff 1
- Staff 2
- Staff 3

and whenever one clicks on a specific staff the SSH key associated to that staff is being shown.

**Alternatives**
None
thesunny commented 1 year ago

This idea is interesting in that it is outside of the core Markdown syntax and is in HTML syntax embedded in Markdown.

I have some ideas for how to do this through extensions in a safe way. It will likely not be part of the core of Wysimark which focuses on Markdown syntax. It can be part of Wysimark extensions which can be plugged into the core.

If this is a high priority feature for you and you are willing to fund development, let me know.

Otherwise, I'll consider this for a list of future Wysimark extensions.

LordSimal commented 1 year ago

This is definitely not a dealbreaker for me so you can put that on "The list" 😉

I am just happy that there are at least some WYSIWYG/Markdown library maintainers out there who respond to github issues.

We already switched Markdown libraries twice and the one we are currently on also seems pretty dead so I am happy with all the support you are able to provide since this library is a strong contender for my documentation system 😁