add <mark> syntax *hello*
This commit is contained in:
parent
abd27eebe9
commit
1136cff702
1 changed files with 4 additions and 2 deletions
|
@ -13,20 +13,22 @@ import qualified Data.Text as Text
|
|||
spans :: Vars => Inline -> IO Inline
|
||||
spans = \case
|
||||
Code attrs txt
|
||||
| Just ('\\', txt') <- Text.uncons txt -> pure $ Code attrs txt'
|
||||
| Just ('\\', txt') <- Text.uncons txt -> pure $ Code attrs txt'
|
||||
| Just txt' <- enclosed "⫽" "⫽" txt -> pure $ ipaA txt'
|
||||
| Just txt' <- enclosed "//" "//" txt -> pure $ ipaA txt'
|
||||
| Just _ <- enclosed "/" "/" txt -> pure $ ipaB txt
|
||||
| Just _ <- enclosed "[" "]" txt -> pure $ ipaN txt
|
||||
| Just txt' <- enclosed "{" "}" txt -> lang txt'
|
||||
| Just txt' <- enclosed "!" "!" txt -> pure $ abbr txt'
|
||||
| Just txt' <- enclosed "*" "*" txt -> pure $ mark txt'
|
||||
i -> pure i
|
||||
|
||||
ipaA, ipaB, ipaN, abbr :: Text -> Inline
|
||||
ipaA, ipaB, ipaN, abbr, mark :: Text -> Inline
|
||||
ipaA = Span (cls ["ipa", "ipa-arch"]) . text' . surround "⫽"
|
||||
ipaB = Span (cls ["ipa", "ipa-broad"]) . text'
|
||||
ipaN = Span (cls ["ipa", "ipa-narrow"]) . text'
|
||||
abbr = Span (cls ["abbr"]) . text' . endash
|
||||
mark txt = RawInline "html" $ "<mark>" <> txt <> "</mark>"
|
||||
|
||||
surround :: Text -> Text -> Text
|
||||
surround s txt = s <> txt <> s
|
||||
|
|
Loading…
Reference in a new issue