8000 Parsing ambiguity between pipe tables and line blocks · Issue #83 · jgm/lunamark · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Parsing ambiguity between pipe tables and line blocks #83
Open
@Omikhleia

Description

@Omikhleia

MWE

local lunamark = require("lunamark")
local opts = {
  line_blocks = true,
  pipe_tables = true,
}
local writer = lunamark.writer.html.new(opts)
local parse = lunamark.reader.markdown.new(writer, opts)

print("--------------- Test 1 ---------------")
local doc1 = parse([[

| Verse 1
| Verse 2
| 
| Verse 3

]])
print(doc1)
print("--------------- Test 2 ---------------")
local doc2 = parse([[

| Verse 1
| 
| Verse 2
| Verse 3

]])
print(doc2)

Results:

  • Test 1 is parsed as a line blocks
  • Test 2 is parsed as a table
--------------- Test 1 ---------------
<div class="line-block">Verse 1<br />
Verse 2<br />
<br />
Verse 3</div>
--------------- Test 2 ---------------
<table>
<thead>
<tr class="header">
</tr>
</thead>
<tbody>
<tr class="odd">
</tr>
<tr class="even">
</tr>
</tbody>
</table>

Well, there is some sort of ambiguity here, and I am not sure that just changing the parsing order is what one would expect in all cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0