Began using Transparent

This commit is contained in:
Pagwin 2026-04-06 15:36:36 -04:00
parent 22f4f89137
commit eaf5d9408c
No known key found for this signature in database
GPG key ID: 81137023740CA260
3 changed files with 5 additions and 2 deletions

View file

@ -54,6 +54,7 @@ elementToHTML (List (L {list_type = Ordered {start_number, style}, items}) attrs
elementToHTML (List (L {list_type = Unordered {style}, items}) attrs) = T.concat ["<ul", maybe "" handleStyle style, ">", generateLiElems items, "</ul>"]
elementToHTML (HTML (HTMLTag {html_content})) = html_content
elementToHTML (Paragraph (P snippets) attrs) = T.concat ["<p", handleAttrs attrs, ">", serializeInlineToHTML snippets, "</p>"]
elementToHTML (Transparent snippets) = serializeInlineToHTML snippets
elementToHTML HorizontalRule = "<hr>"
elementToHTML (Table _ _) = error "TODO"
elementToHTML (Container _ _) = error "TODO"

View file

@ -13,6 +13,8 @@ data Element
| -- Markdown only, DJOT will produce a RawBlock with an html type
HTML HTML
| Paragraph Paragraph Attrs
| -- to avoid breaking generation when swapping InlineText to Element in Markdown parser
Transparent [InlineText]
| HorizontalRule
| Table Table Attrs
| -- Djot :::

View file

@ -155,7 +155,7 @@ blockquoteBlock = do
-- this dance with optional and notFollowedBy is done so we
-- aren't accidentally consuming part of a block ending
(optional ((notFollowedBy blockEnding) *> lineEnding))
pure [(Paragraph $ P ret) emptyAttrs]
pure [Transparent ret]
-- type of list the parser returns
-- parser which grabs the prefix for each item of the list
@ -175,7 +175,7 @@ listBlock list_type prefix child_parser_factory nest_level = do
child <- optional $ child_parser_factory $ nest_level + 1
error "TODO, child list handling works different now, child needs to be combined into content"
pure $ LI {content = [Paragraph (P content) emptyAttrs]}
pure $ LI {content = [Transparent content]}
unorderedListBlock :: (Logger m, Characters s) => Int -> Parser s m Element
unorderedListBlock = listBlock Unordered {style = Nothing} unordered_prefix (\level -> unwrap <$> ((try $ unorderedListBlock level) <|> orderedListBlock level))