Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong data in table #287

Closed
asjqkkkk opened this issue May 24, 2020 · 2 comments · Fixed by #288
Closed

wrong data in table #287

asjqkkkk opened this issue May 24, 2020 · 2 comments · Fixed by #288
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@asjqkkkk
Copy link

markdown source

| header 1 | header 2 |
| --- | --- |
| a == 3 \|\| b > 4 | row 1 col 2 |

parse code

    final content = mdFile.readAsStringSync();
    final m.Document document = m.Document(
        extensionSet: m.ExtensionSet.gitHubFlavored,
        encodeHtml: false);
    final List<String> lines = content.split(RegExp(r'\r?\n'));
    final nodes = document.parseLines(lines);

then I log all nodes, I got it

parsed data logs

Tag:table   attr:{}
  Tag:thead   attr:{}
    Tag:tr   attr:{}
      Tag:th   attr:{}
        Text:header 1
      Tag:th   attr:{}
        Text:header 2
  Tag:tbody   attr:{}
    Tag:tr   attr:{}
      Tag:td   attr:{}
        Text:a == 3 ||b > 4
      Tag:td   attr:{}
        Text:row 1 col 2

there should be a space

image

but the result seems to be wrong

image

Is there a bug? Or I'm using it in a wrong way?🤔️

@srawlins
Copy link
Member

I get the correct spacing on the command line:

$ dart bin/markdown.dart 
| header 1 | header 2 |

| --- | --- |

| a == 3 \|\| b > 4 | row 1 col 2 |

<p>| header 1 | header 2 |</p>
<p>| --- | --- |</p>
<p>| a == 3 || b &gt; 4 | row 1 col 2 |</p>

This may be a bug in your logging code?

@srawlins
Copy link
Member

Oops, haha, that did not generate a table! If I use the GitHubFlavored extension set, I see your bug:

$ dart bin/markdown.dart --extension-set GitHubFlavored
| header 1 | header 2 |
| --- | --- |
| a == 3 \|\| b > 4 | row 1 col 2 |
<table><thead><tr><th>header 1</th><th>header 2</th></tr></thead><tbody><tr><td>a == 3 ||b &gt; 4</td><td>row 1 col 2</td></tr></tbody></table>

@srawlins srawlins added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants