Behaviour SwRS-MDOKFSTUDIO-CORE-003
Every rendered block maps to its absolute source lines
When a document is rendered, the extension SHALL give every paragraph, heading, block quote, list, list item, code block, table, math block, thematic break and definition list a one-based source line, with an end line for a multi-line block, counted in the whole file after a leading frontmatter block is left out of the body.
Part of StRS-MDOKFSTUDIO-CORE-001, outside the paths drawn on its map.
Scenarios 8
The situations the tests check; open one to read it.
nominalMap each block to its source line
Givena document whose third line starts a paragraph
Whenit is rendered
Thenthat paragraph element carries source line 3
nominalMap a multi-line block to its end line
Givena code fence on lines 5 to 9
Whenit is rendered
Thenthe block carries start line 5 and end line 9
boundaryMap a one-line block and a directive child
| Input | Outcome |
|---|---|
| a one-line paragraph | the block carries its start line and no larger end line |
| a directive whose children have no position of their own | each child carries the line of the directive |
nominalHide leading frontmatter from the body
Givena document that starts with a YAML frontmatter block
Whenit is rendered
Thenthe body holds no code block for the frontmatter
boundaryOnly the leading block is frontmatter
Givena document with a thematic break `---` later in the text
Whenit is rendered
Thenonly the leading block is treated as frontmatter and the later `---` line is unchanged
boundaryKeep body lines absolute after frontmatter
| Input | Outcome |
|---|---|
| a frontmatter block of four lines then a paragraph (LF) | the paragraph carries source line 5 |
| the same document saved with CRLF line breaks | the paragraph still carries source line 5 |
| the same document with CR line breaks | the body source lines equal the absolute file line |
nominalMap image-only blocks
Givena paragraph holding only an image, an `{image}` directive or a lone raw `<img>` element
Whenit is rendered
Thenthe image block is mapped with its source lines, so an insert point can follow it
refusalDrop a raw image without source
Givena raw `<img>` without a `src` attribute
Whenit is rendered
Thenthe element is dropped
Implemented in 4
Tested by 3
Replaces
SwRS-MDOKFSTUDIO-CORE-004Map a multi-line block to its end line superseded superseded by SwRS-MDOKFSTUDIO-CORE-003 Markdown file
SwRS-MDOKFSTUDIO-CORE-005Hide leading frontmatter from the body superseded superseded by SwRS-MDOKFSTUDIO-CORE-003 Markdown file
SwRS-MDOKFSTUDIO-CORE-006Keep body lines absolute after frontmatter superseded superseded by SwRS-MDOKFSTUDIO-CORE-003 Markdown file
SwRS-MDOKFSTUDIO-CORE-007Map image-only blocks superseded superseded by SwRS-MDOKFSTUDIO-CORE-003 Markdown file