neuron icon indicating copy to clipboard operation
neuron copied to clipboard

YAML pipe syntax not parsed

Open Nadrieril opened this issue 5 years ago • 3 comments

---
title: |
  Some title
---

Foo

Error:

user error (20eescg.md:2:0: error
   | 
 2 |   Some title
   | ^
Unexpected ' ')

That used to work with the commit from a few hours ago, so I'm guessing https://github.com/srid/neuron/commit/c77d4f0920917921495e3cea5579a096cb8156b3 broke it

Nadrieril avatar May 13 '20 22:05 Nadrieril

Took inspiration from https://stackoverflow.com/a/46227637 , and the following seems to work (no need to try):

    startOfLine :: Parser ()
    startOfLine = do
      pos <- M.getSourcePos
      guard (M.sourceColumn pos == M.pos1)
    separatorP :: Parser ()
    separatorP =
       void $ startOfLine *> M.string "---" <* M.eol

Nadrieril avatar May 13 '20 22:05 Nadrieril

Looks like we need some tests around for partitioner.

srid avatar May 13 '20 22:05 srid

We may be able to borrow some ideas from mmark:

https://github.com/mmark-md/mmark/blob/ab4616e27b39c4a100223788eaa1b5911f1276d7/Text/MMark/Parser.hs#L157-L172

And specs:

https://github.com/mmark-md/mmark/blob/18c7d320f496f54833dfd24584f1760c7857b9b5/tests/Text/MMarkSpec.hs

srid avatar May 14 '20 00:05 srid