Skip to content

Commit 32f2588

Browse files
committed
Make Sequence[str] an InlineContent
This reduces the cases were Inlines is needed.
1 parent fc30dfc commit 32f2588

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

quartodoc/pandoc/inlines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def as_list_item(self):
6060

6161
# TypeAlias declared here to avoid forward-references which
6262
# break beartype
63-
InlineContent: TypeAlias = str | Inline | Sequence[Inline]
63+
InlineContent: TypeAlias = str | Inline | Sequence[str | Inline]
6464

6565

6666
@dataclass
@@ -219,7 +219,7 @@ def join_inline_content(content: Sequence[InlineContent]) -> str:
219219
"""
220220
Join a sequence of inlines into one string
221221
"""
222-
return SEP.join(str(c) for c in content if c)
222+
return SEP.join(inlinecontent_to_str(c) for c in content if c)
223223

224224

225225
def inlinecontent_to_str(content: Optional[InlineContent]):

quartodoc/tests/pandoc/test_inlines.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ def test_inlines():
6565
i = Inlines(["a", Span("b"), Emph("c")])
6666
assert str(i) == "a [b]{} *c*"
6767

68+
i = Inlines(["a", Span("b"), Emph("c"), ["d", Strong("e")]])
69+
assert str(i) == "a [b]{} *c* d **e**"
70+
6871
i = Inlines(["a", Span("b"), Emph("c"), Inlines(["d", Strong("e")])])
6972
assert str(i) == "a [b]{} *c* d **e**"
7073

0 commit comments

Comments
 (0)