Skip to content

Commit

Permalink
Work around for elm/core bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arowM committed Apr 30, 2023
1 parent f9427c9 commit 9fd1f72
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/MarkdownAst.elm
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,12 @@ normalizePlainText rawStr =

hasLastSpace =
String.right 1 rawStr
|> String.any isWhiteSpace
-- `|> String.any isWhiteSpace` may cause infinite loop
|> String.foldl
(\c acc ->
acc || isWhiteSpace c
)
False

words =
case normalizedWords rawStr of
Expand Down
2 changes: 1 addition & 1 deletion src/Sample.elm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ myMarkdown =
{ ordered = False
, items =
[ { content =
[ Ast.PlainText "List Item 1"
[ Ast.PlainText "List Item 1😈"
]
, children =
[ Ast.ListBlock
Expand Down
2 changes: 1 addition & 1 deletion tests/MarkdownAstSuite.elm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Markdown AST represents *Markdown* AST.
## Section
* List Item 1
* List Item 1😈
1. Child item
* List Item 2
Expand Down

0 comments on commit 9fd1f72

Please sign in to comment.