cebe / cebe/markdown

Inline HTML support with <details> and <summary> in Github flavored markdown

Open
#163 6 comments 4 reactions 0 assignees View on GitHub
consistency enhancement gfm
Dominant language
HTML
Stars
1k
Forks
137
PR merge metrics
No merged PRs in 30d

Description

[<details>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) and [<summary>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary) are tags introduced in HTML5 as a way to enclose collapsible / expandable widgets. Both [Github](https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d) and [Gitlab](https://docs.gitlab.com/ee/user/markdown.html#details-and-summary) support using them as inline HTML. And they are parsed and displayed properly. Moreover, markdown tags within them are parsed correctly.

People uses them to enclose less important information, such as advanced examples. And by using them, the display of README.md are much easier to read.

Please check the below example. This library does not give the same result parsing the code the same way Github does:

## Example

### Markdown
> <details open=true><summary>Some PHP example (expanded)</summary>
>
> \`\`\`php
> <?php
>
> // this is a comment
> echo "hello world";
>
> ?>
> \`\`\`
>
> </details>
>
> <details><summary>Some PHP example (collapsed)</summary>
>
> \`\`\`php
> <?php
>
> // this is a comment
> echo "hello world";
>
> ?>
> \`\`\`
>
> </details>

### Parsed result on Github

Some PHP example (expanded)

```php

```

Some PHP example (collapsed)

```php

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.