Repository navigation
Match djot.js on attributes before reference-like lines, marker-line attributes, empty raw blocks and trailing backslash-space - #351
Merged
Conversation
…attributes, empty raw blocks and trailing backslash-space
- A single-line block attribute followed by a [label]: line is always
queued; a real definition consumes it, otherwise the next block gets it.
Before, it was dropped unless warnings or implicit heading references
turned reference collection on.
- A tight list item whose marker line holds {...} parses its lines as
blocks, so the attributes reach the paragraph below instead of leaving
a leading soft break.
- A raw block with only blank lines keeps them; an empty raw block
renders nothing.
- A backslash before trailing spaces or tabs at the end of a block's
last line is a hard break, as the syntax reference says. Table cells
and nested inline text keep the non-breaking space.
…te heading id words djot.js leaves a backslash before a tab that does not end the line as literal text; the parser dropped the backslash. An escaped space (non-breaking space) in a heading leaked into the generated id as instead of separating the words like any other space.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #351 +/- ##
============================================
+ Coverage 93.50% 93.52% +0.01%
- Complexity 5057 5060 +3
============================================
Files 118 118
Lines 13243 13246 +3
============================================
+ Hits 12383 12388 +5
+ Misses 860 858 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four small conformance leftovers from the deep-dive fix lanes, plus two adjacent cases the differential sweep found in the same code paths. Output checked against djot.js.
Attribute block before a reference-like line (F24)
A single-line block attribute followed by a
[label]:line was dropped unless warnings or implicit heading references turned reference collection on, so the output depended on the warnings option. The attributes are now always queued; a real reference definition consumes them, anything else receives them.Input:
Before (warnings off):
After (warnings on or off), as djot.js:
{y}(the boolean-attribute extension) now gives<p y="">[r]: p q</p>in both modes.Marker-line attributes over an indented line (F21)
A tight item whose marker line holds
{...}sent its lines to the inline parser, so the attribute became an inline one with no target and left a leading soft break. The item lines now go through the block parser, which reads the attribute as a block attribute.Input:
Before:
After, as djot.js:
In a tight list (
- {#t .p}thenx) the paragraph keeps its<p>because it carries attributes, the existing tight-item policy pinned byTightItemParagraphsTest; before, it printed an empty line.Empty raw block (F25)
A raw block with no lines and one with only blank lines were both stored as
"", and the renderer added a newline to both. A blank-only block now keeps its newlines and an empty one renders nothing. Blank lines around real content are still trimmed (pinned byBlockParserTest::testRawBlockTrimsLeadingAndTrailingBlankLines).Input:
Before: one empty line. After, as djot.js: no output.
Input:
Before: one empty line. After: two, as djot.js.
Backslash before trailing whitespace at the end of a block
The djot syntax reference: "Backslash before a newline (or before spaces or tabs followed by a newline) is parsed as a hard line break." The last line of a block has no newline left after parsing, so the escape became a non-breaking space. The end of the parsed text now counts as a line end at the top inline level; table cells (text ends at
|) and nested inline text (link text) keep the non-breaking space, as in djot.js.Input (trailing space after the backslash):
Before:
After, as djot.js:
Found by the sweep, same code paths
A backslash before a tab inside a line was dropped; djot.js keeps it literal (a tab is not escapable).
Before
<p>x y</p>, after<p>x\ y</p>.An escaped space in a heading leaked into the id:
# x \ ygaveid="x- y", nowid="x-y"as djot.js.Verification
SmallConformanceLeftoversTest; each fails with its fix reverted. Every case is asserted with warnings off and on.:definition terms, the trimmed blank lines around raw content, and lazy lines after a reference definition inside a container (pre-existing, unchanged).Codex review (medium): "I found no actionable regressions in the diff. The test suite passes."