Shouldn't *.../.../...* be nested?
liwoxa opened this issue · comments
liwoxa commented
I want to do X
I wish
A *strongly emphasized bit with an inner /additionally/ emphasized bit*.
could be rendered as (1)
A <strong>strongly emphasized bit with an inner <em>additionally</em> emphasized bit</strong>.
but the design seems to prohibit this, only allowing something like (2)
A <strong>strongly emphasized bit with an inner </strong><strong><em>additionally</em></strong><strong> emphasized bit</strong>.
If only I could do Y
If the package would expose something like
type Nestable
= Strong
| Em
| Del
Mark.textNestable : (Nestable -> text -> text) -> Block (List text)
-- ------
-- not sure about this part of the type
then instead of something like (1)
styledText styles string =
if styles.bold then
if styles.italic then
Html.strong [] [ Html.em [] [ Html.text string ] ]
else
Html.strong [] [ Html.text string ]
else
if styles.italic then
Html.em [] [ Html.text string ]
else
Html.text string
-- For brevity I ignored `styles.strike`
textify = Mark.text styledText
I could write (2)
nestedText nest content =
case nest of
Bold ->
Html.strong [] content
Em ->
Html.em [] content
Del ->
Html.del [] content
textify = Mark.textNestable nestedText