My current understanding is that grid tables will not be supported by the parser and users should migrate away via qmd-syntax-helper. If that is not the case feel free close and ignore the following.
Currently at best a grid table will parse as a sequence of paragraphs containing literal +, -, | runs. If exported as qmd the output is escaped and the grid table syntax is broken.
Alternatively, often the parser gets confused by the syntax and will throw an unrelated error due to unclosed / unpaired delimiters or other perceived issues.
Would it be possible to include a basic "detector" in the parser that identifies a block of text as a grid table, consumes the entire block without trying to further parse things and then emit a parser error specific to not supporting grid tables.
It seems reasonable to be able to recognize the +[-=+]{3,}+ opening border followed by |-delimited cell rows and the matching closing border, but I'm sure there are plenty of edge cases.
Below are a couple examples of the current parsing issues:
paragraph fallback
$ printf '%s\n' '+------+--------+' '| key | val |' '+------+--------+' '| a | hello |' '+------+--------+' | cargo run --bin pampa --
[ Para [Str "+------+--------+", SoftBreak, Str "|", Space, Str "key", Space, Str "|", Space, Str "val", Space, Str "|"],
Para [Str "+------+--------+", SoftBreak, Str "|", Space, Str "a", Space, Str "|", Space, Str "hello", Space, Str "|"],
Para [Str "+------+--------+"] ]
$ printf '%s\n' '+------+--------+' '| key | val |' '+------+--------+' '| a | hello |' '+------+--------+' | cargo run --bin pampa -- -t qmd
+------+--------+
\| key \| val \|
+------+--------+
\| a \| hello \|
+------+--------+
secondary error(s)
$ printf '%s\n' '+-------------+' '| ```bash |' '| ls -la |' '| ``` |' '+-------------+'
+-------------+
| ```bash |
| ls -la |
| ``` |
+-------------+
$ printf '%s\n' '+-------------+' '| ```bash |' '| ls -la |' '| ``` |' '+-------------+' | cargo run --bin pampa --
Error: Parse error
╭─[ <stdin>:2:3 ]
│
2 │ | ```bash |
│ ┬
│ ╰── unexpected character or token here
───╯
Error: Parse error
╭─[ <stdin>:4:3 ]
│
4 │ | ``` |
│ ┬
│ ╰── unexpected character or token here
───╯
My current understanding is that grid tables will not be supported by the parser and users should migrate away via qmd-syntax-helper. If that is not the case feel free close and ignore the following.
Currently at best a grid table will parse as a sequence of paragraphs containing literal
+,-,|runs. If exported as qmd the output is escaped and the grid table syntax is broken.Alternatively, often the parser gets confused by the syntax and will throw an unrelated error due to unclosed / unpaired delimiters or other perceived issues.
Would it be possible to include a basic "detector" in the parser that identifies a block of text as a grid table, consumes the entire block without trying to further parse things and then emit a parser error specific to not supporting grid tables.
It seems reasonable to be able to recognize the
+[-=+]{3,}+opening border followed by|-delimited cell rows and the matching closing border, but I'm sure there are plenty of edge cases.Below are a couple examples of the current parsing issues:
paragraph fallback
secondary error(s)