Closed chenzhiguang closed 1 year ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
lib/src/block_parser.dart | 4 | 5 | 80.0% | ||
lib/src/document.dart | 2 | 4 | 50.0% | ||
lib/src/block_syntaxes/block_syntax.dart | 1 | 5 | 20.0% | ||
<!-- | Total: | 78 | 85 | 91.76% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
lib/src/util.dart | 1 | 98.18% | ||
lib/src/block_syntaxes/fenced_code_block_syntax.dart | 1 | 98.08% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 3542193180: | -0.3% |
Covered Lines: | 1230 |
Relevant Lines: | 1300 |
Can we review this sooner? I need it to create PRs to fix the tab related issues.
We'll need to get this working w/ flutter_markdown
– which is tricky because the API has changed!
Yes, I think we can use the same way as we did before to fix it.
Now it looks better.
Help me understand the point of Line
? The API is now a bit more complex. What do we get by having a Line
construct instead of just using String
? (Might be good to have in the change log, too)
I found It seems the tab issues could be fixed without using this Line
type. I will do more research tomorrow.
The idea came from https://github.com/tagnote-app/dart_markdown/blob/master/lib/src/line.dart, but the Line there maintains much more information.
Also: mind running benchmarks?
No difference, I have tried. Let me do it again
just because we're allocating a bit more...
We might need this Line
in the future.
@kevmoo
We might still need Line
to maintain the tabRemaining
, we can not just simply convert the tabRemaining
to spaces and prepend them to a string, then passes it to the nested structure.
For example: (See: https://spec.commonmark.org/0.30/#example-5)
- foo
→→bar
There are 2 space sized tabRemaining
from the list block, if we just prepend two spaces to →bar
like this ..→bar
,
the output of the indented code block will be: (See: https://spec.commonmark.org/0.30/#example-2)
<pre><code>foo
</code></pre>
More information about tabs behaves: see https://spec.commonmark.org/0.30/#tabs
Tabs in lines are not expanded to spaces. However, in contexts where spaces help to define block structure, tabs behave as if they were replaced by spaces with a tab stop of 4 characters.
Thus, for example, a tab can be used instead of four spaces in an indented code block. (Note, however, that internal tabs are passed through as literal tabs, not expanded to spaces.)
I have added some more comment for the tabRemaining
property of Line
.
Sorry for this back and forth, it has been a few months since I created this Line
type, I should have written a detailed comment.
Should we continue? I am blocked by this PR.
@srawlins should really chime in here
What do we say?
@srawlins Hi Sam, I need your decision in order to plan the next steps. cc @kevmoo
I will try to get to this today.
@srawlins Hi Sam, please don’t forget this one.
No worries! Thanks!
The
Line
is used to maintain thetabRemaining
for now.This is a use case of
Line
, it can also explain the meaning of thetabRemaining
: https://spec.commonmark.org/0.30/#example-6In this example the
tabRemaining
is the two spaces from blockquote which will be used in the nested indented code block.