mirror of
https://github.com/github/semantic.git
synced 2024-12-26 08:25:19 +03:00
Render Markdown blobs to ToCs.
This commit is contained in:
parent
1bdec36140
commit
26d1b600be
@ -45,6 +45,7 @@ parseBlobs renderer = fmap toS . distributeFoldMap (parseBlob renderer) . filter
|
||||
-- | A task to parse a 'SourceBlob' and render the resulting 'Term'.
|
||||
parseBlob :: TermRenderer output -> SourceBlob -> Task output
|
||||
parseBlob renderer blob@SourceBlob{..} = case (renderer, blobLanguage) of
|
||||
(ToCTermRenderer, Just Language.Markdown) -> parse markdownParser source >>= decorate (markupSectionAlgebra (Proxy :: Proxy Markdown.Error) source) >>= render (renderToCTerm blob)
|
||||
(ToCTermRenderer, Just Language.Python) -> parse pythonParser source >>= decorate (declarationAlgebra (Proxy :: Proxy Python.Error) source) . hoistCofree (weaken :: Union fs a -> Union (Declaration.Method ': fs) a) >>= render (renderToCTerm blob)
|
||||
(ToCTermRenderer, _) -> parse syntaxParser source >>= decorate (syntaxDeclarationAlgebra source) >>= render (renderToCTerm blob)
|
||||
(JSONTermRenderer, Just Language.Markdown) -> parse markdownParser source >>= render (renderJSONTerm blob)
|
||||
|
Loading…
Reference in New Issue
Block a user