mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Add thematic breaks (separators, horizontal rules, lines).
This commit is contained in:
parent
6d7602dc64
commit
3e527cd7b8
@ -47,6 +47,12 @@ newtype BlockQuote a = BlockQuote [a]
|
||||
instance Eq1 BlockQuote where liftEq = genericLiftEq
|
||||
instance Show1 BlockQuote where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data ThematicBreak a = ThematicBreak
|
||||
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
|
||||
|
||||
instance Eq1 ThematicBreak where liftEq = genericLiftEq
|
||||
instance Show1 ThematicBreak where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- Inline elements
|
||||
|
||||
|
@ -27,6 +27,7 @@ type Syntax =
|
||||
, Markup.Heading
|
||||
, Markup.OrderedList
|
||||
, Markup.Paragraph
|
||||
, Markup.ThematicBreak
|
||||
, Markup.UnorderedList
|
||||
-- Inline elements
|
||||
, Markup.Code
|
||||
@ -51,7 +52,7 @@ assignment = makeTerm <$> symbol Document <*> children (Markup.Document <$> many
|
||||
-- Block elements
|
||||
|
||||
blockElement :: Assignment
|
||||
blockElement = paragraph <|> list <|> heading <|> blockQuote <|> codeBlock
|
||||
blockElement = paragraph <|> list <|> heading <|> blockQuote <|> codeBlock <|> thematicBreak
|
||||
|
||||
paragraph :: Assignment
|
||||
paragraph = makeTerm <$> symbol Paragraph <*> children (Markup.Paragraph <$> many inlineElement)
|
||||
@ -73,6 +74,9 @@ blockQuote = makeTerm <$> symbol BlockQuote <*> children (Markup.BlockQuote <$>
|
||||
codeBlock :: Assignment
|
||||
codeBlock = makeTerm <$> symbol CodeBlock <*> (Markup.Code <$> project (\ (((CMark.CODE_BLOCK language _) :. _) :< _) -> nullText language) <*> source)
|
||||
|
||||
thematicBreak :: Assignment
|
||||
thematicBreak = makeTerm <$> symbol ThematicBreak <*> (Markup.ThematicBreak <$ source)
|
||||
|
||||
|
||||
-- Inline elements
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user