Skip to content

Commit

Permalink
Support GitHub-flavoured markdown in readmes (fix flora-pm#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses4ever authored Sep 16, 2022
1 parent 15559bc commit 1c0cbb6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Flora/OddJobs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ module Flora.OddJobs
where

import Commonmark qualified
import Commonmark.Extensions (defaultSyntaxSpec, gfmExtensions)
import Control.Concurrent (forkIO)
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class
import Data.Aeson (Result (..), fromJSON, toJSON)
import Data.Function ((&))
import Data.Pool
import Data.Text
import Data.Text.Display
Expand Down Expand Up @@ -122,10 +124,9 @@ makeReadme pay@MkReadmePayload{..} = localDomain "fetch-readme" $ do
logInfo ("got a body for package " <> display mpPackage) (object ["release_id" .= mpReleaseId])

htmlTxt <- do
-- let extensions = emojiSpec
-- Commonmark.commonmarkWith extensions ("readme " <> show mpPackage) bodyText
pure (Commonmark.commonmark ("readme " <> show mpPackage) bodyText)
>>= \case
let extensions = gfmExtensions <> defaultSyntaxSpec
Commonmark.commonmarkWith extensions ("readme " <> show mpPackage) bodyText
& \case
Left exception -> throw (MarkdownFailed exception)
Right (y :: Commonmark.Html ()) -> pure $ Commonmark.renderHtml y

Expand Down

0 comments on commit 1c0cbb6

Please sign in to comment.