Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

- Fixed inline element with attributes is inside a bulleted list not
being processed correctly.

## v10.1.0 - 2026-01-23

- Added the `inner_text` function.
Expand All @@ -14,7 +19,6 @@
- Added support for nested lists.
- Added support for ordered lists.
- Improved support for spans with attributes.

## v8.0.0 - 2025-11-28

- Added support for inline attributes on links and images.
Expand Down
14 changes: 1 addition & 13 deletions src/jot.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ fn parse_attributes(
let in = drop_spaces(in)
case in {
"" -> None
"}" <> in -> parse_attributes_end(in, attrs)
"}" <> in -> Some(#(attrs, in))
"#" <> in -> {
case parse_attributes_id_or_class(in, "") {
Some(#(id, in)) -> parse_attributes(in, add_attribute(attrs, "id", id))
Expand Down Expand Up @@ -984,18 +984,6 @@ fn parse_attributes_id_or_class(
}
}

fn parse_attributes_end(
in: String,
attrs: Dict(String, String),
) -> Option(#(Dict(String, String), String)) {
case in {
"" -> Some(#(attrs, ""))
"\n" <> in -> Some(#(attrs, in))
" " <> in -> parse_attributes_end(in, attrs)
_ -> Some(#(attrs, in))
}
}

fn parse_block_quote(
in: String,
refs: Refs,
Expand Down
29 changes: 29 additions & 0 deletions test/cases/links_and_images.test
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,32 @@ a link or span or image.
.
<p><span class="bar_">x_y</span></p>
```

Link with attributes in a list (issue #43):
```
- This is a [link](#){.wibble}
.
<ul>
<li>
This is a <a class="wibble" href="#">link</a>
</li>
</ul>
```

Link with attributes followed by text:
```
This is a [link](#){.wibble} more text
.
<p>This is a <a class="wibble" href="#">link</a> more text</p>
```

Link with attributes followed by text in a list:
```
- This is a [link](#){.wibble} more text
.
<ul>
<li>
This is a <a class="wibble" href="#">link</a> more text
</li>
</ul>
```