From b5c7df87053fcb76d1eb4c5f58201c2891a2e5e6 Mon Sep 17 00:00:00 2001 From: Renatillas Date: Sun, 4 Jan 2026 21:56:19 +0100 Subject: [PATCH 1/4] Fix issue #43 --- src/jot.gleam | 7 +------ test/cases/links_and_images.test | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/jot.gleam b/src/jot.gleam index 0a97ad6..56a3039 100644 --- a/src/jot.gleam +++ b/src/jot.gleam @@ -988,12 +988,7 @@ 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)) - } + Some(#(attrs, in)) } fn parse_block_quote( diff --git a/test/cases/links_and_images.test b/test/cases/links_and_images.test index 2b13b37..017592e 100644 --- a/test/cases/links_and_images.test +++ b/test/cases/links_and_images.test @@ -249,3 +249,32 @@ a link or span or image. .

x_y

``` + +Link with attributes in a list (issue #43): +``` +- This is a [link](#){.wibble} +. + +``` + +Link with attributes followed by text: +``` +This is a [link](#){.wibble} more text +. +

This is a link more text

+``` + +Link with attributes followed by text in a list: +``` +- This is a [link](#){.wibble} more text +. + +``` From 1eb2bb1c0bb76a5129cb8a81167387497a90a0fe Mon Sep 17 00:00:00 2001 From: Renatillas Date: Sun, 4 Jan 2026 21:58:56 +0100 Subject: [PATCH 2/4] Simplify --- src/jot.gleam | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/jot.gleam b/src/jot.gleam index 56a3039..bc34352 100644 --- a/src/jot.gleam +++ b/src/jot.gleam @@ -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)) @@ -984,13 +984,6 @@ fn parse_attributes_id_or_class( } } -fn parse_attributes_end( - in: String, - attrs: Dict(String, String), -) -> Option(#(Dict(String, String), String)) { - Some(#(attrs, in)) -} - fn parse_block_quote( in: String, refs: Refs, From c484cabee06485c1b94573d3fcd02ec4ee09ca80 Mon Sep 17 00:00:00 2001 From: Renatillas Date: Thu, 8 Jan 2026 16:20:36 +0100 Subject: [PATCH 3/4] Changelog --- CHANGELOG.md | 5 ++++- src/jot.gleam | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3a4e3a..2dd34f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [Unreleased] + +- Fixed inline element with attributes is inside a bulleted list not being processed correctly. + ## v10.0.0 - 2026-01-19 - Added support for symbols. @@ -10,7 +14,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. diff --git a/src/jot.gleam b/src/jot.gleam index bc34352..5a94001 100644 --- a/src/jot.gleam +++ b/src/jot.gleam @@ -984,6 +984,18 @@ 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) + _ -> None + } +} + fn parse_block_quote( in: String, refs: Refs, From 5129014b67ab1aaa16f82e681e9ff027ca96c578 Mon Sep 17 00:00:00 2001 From: Renatillas Date: Thu, 22 Jan 2026 13:12:39 +0100 Subject: [PATCH 4/4] fix: Remove unused function --- src/jot.gleam | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/jot.gleam b/src/jot.gleam index 5a94001..bc34352 100644 --- a/src/jot.gleam +++ b/src/jot.gleam @@ -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) - _ -> None - } -} - fn parse_block_quote( in: String, refs: Refs,