mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Assign inline code.
This commit is contained in:
parent
b5a7b90d69
commit
95811013bd
@ -79,3 +79,9 @@ data Image a = Image { imageURL :: ByteString, imageTitle :: ByteString }
|
||||
|
||||
instance Eq1 Image where liftEq = genericLiftEq
|
||||
instance Show1 Image where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Code a = Code ByteString
|
||||
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
|
||||
|
||||
instance Eq1 Code where liftEq = genericLiftEq
|
||||
instance Show1 Code where liftShowsPrec = genericLiftShowsPrec
|
||||
|
@ -28,6 +28,7 @@ type Syntax =
|
||||
, Markup.Paragraph
|
||||
, Markup.UnorderedList
|
||||
-- Inline elements
|
||||
, Markup.Code
|
||||
, Markup.Emphasis
|
||||
, Markup.Image
|
||||
, Markup.Link
|
||||
@ -72,7 +73,7 @@ blockQuote = makeTerm <$> symbol BlockQuote <*> children (Markup.BlockQuote <$>
|
||||
-- Inline elements
|
||||
|
||||
inlineElement :: Assignment
|
||||
inlineElement = strong <|> emphasis <|> text <|> link <|> image
|
||||
inlineElement = strong <|> emphasis <|> text <|> link <|> image <|> code
|
||||
|
||||
strong :: Assignment
|
||||
strong = makeTerm <$> symbol Strong <*> children (Markup.Strong <$> many inlineElement)
|
||||
@ -89,6 +90,9 @@ link = makeTerm <$> symbol Link <*> (uncurry Markup.Link <$> project (\ (((CMark
|
||||
image :: Assignment
|
||||
image = makeTerm <$> symbol Image <*> (uncurry Markup.Image <$> project (\ (((CMark.IMAGE url title) :. _) :< _) -> (toS url, toS title))) <* source
|
||||
|
||||
code :: Assignment
|
||||
code = makeTerm <$> symbol Code <*> (Markup.Code <$> source)
|
||||
|
||||
|
||||
-- Implementation details
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user