Skip to content

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

@yookoala

Description

@yookoala

<details> and <summary> are tags introduced in HTML5 as a way to enclose collapsible / expandable widgets. Both Github and Gitlab 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

// this is a comment
echo "hello world";

?>
Some PHP example (collapsed)
<?php

// this is a comment
echo "hello world";

?>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions