Sitelet https://github.com/slamdata/purescript-markdown/pull/83/files
Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Text/Markdown/SlamDown/Parser.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import Data.List as L
import Data.Maybe as M
import Data.Monoid (mempty)
import Data.String as S
import Data.String.Regex as RGX
import Data.String.Regex.Unsafe as URX
import Data.String.Regex.Flags as RXF
import Data.Traversable (traverse)
import Data.Validation.Semigroup as V

Expand Down Expand Up @@ -372,6 +375,7 @@ tabsToSpaces = S.replace (S.Pattern "\t") (S.Replacement " ")
parseMd ∷ ∀ a. (SD.Value a) ⇒ String → Either String (SD.SlamDownP a)
parseMd s = map SD.SlamDown bs
where
lines = L.fromFoldable $ S.split (S.Pattern "\n") $ S.replace (S.Pattern "\r") (S.Replacement "") $ tabsToSpaces s
slashR = URX.unsafeRegex "\\r" RXF.global
lines = L.fromFoldable $ S.split (S.Pattern "\n") $ RGX.replace slashR "" $ tabsToSpaces s
ctrs = parseContainers mempty lines
bs = parseBlocks ctrs