FIX: allows to use open attribute with details (#29116)

Supporting `open` allows to show a `details` block open by default.

Usage:

```
[details open]
my visible content
[/details]
```
This commit is contained in:
Joffrey JAFFEUX
2024-10-08 11:13:44 +09:00
committed by GitHub
parent 85774cc214
commit fd15562939
2 changed files with 21 additions and 2 deletions

View File

@ -20,10 +20,25 @@ RSpec.describe PrettyText do
HTML
end
it "supports open attribute" do
cooked_html = PrettyText.cook <<~MARKDOWN
[details open]
bar
[/details]
MARKDOWN
expect(cooked_html).to match_html <<~HTML
<details open="">
<summary></summary>
<p>bar</p>
</details>
HTML
end
it "deletes elided content" do
cooked_html = PrettyText.cook <<~MARKDOWN
Hello World
<details class='elided'>42</details>
MARKDOWN