You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice that the end of the line character \n only exists at the token.raw and undetectable under its children tokens or token.text. This is also confirmed by this previous issue I asked.
Expected behavior
My question is: Does this behaviour work for EVERY block-level token? That is, for every block-level token, when a '\n' character is at the end of that block, is it always only accessible and detectable in the token.raw property?
Example
I tested list, paragraph, heading, codeBlock, blockQuote in the official demo website. They seem to follow my expectations.
For example, the tokenization result from heading, codeBlock and BlockQuote tokens in my case is the following:
For hr token, since it only has the token.raw property but no token.text property, so this block-level token is not in the range of my question:
// '---\n'{type:"hr",raw:"---"}
The text was updated successfully, but these errors were encountered:
Bistard
changed the title
[Question] Is every block-level token ignoring the end of the line
[Question] Consistent Behavior of End-of-Line Characters Across Block-Level Tokens
Oct 27, 2024
Marked version: 14.1.2
Background
This is not a bug, but rather a confusion from me. Consider the following text and tokenization result:
I notice that the end of the line character
\n
only exists at thetoken.raw
and undetectable under its children tokens ortoken.text
. This is also confirmed by this previous issue I asked.Expected behavior
My question is: Does this behaviour work for EVERY block-level token? That is, for every block-level token, when a '\n' character is at the end of that block, is it always only accessible and detectable in the
token.raw
property?Example
I tested
list
,paragraph
,heading
,codeBlock
,blockQuote
in the official demo website. They seem to follow my expectations.For example, the tokenization result from
heading
,codeBlock
andBlockQuote
tokens in my case is the following:But I tried
html
token, seems like an exception:Additionals
For
hr
token, since it only has thetoken.raw
property but notoken.text
property, so this block-level token is not in the range of my question:The text was updated successfully, but these errors were encountered: