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
In a webpage I wrote to display Markdown, I enabled hard line breaks and set first-line indentation for each paragraph:
p {
text-indent:2em;
}
However, current browsers cannot handle indentation for every line within the same paragraph, resulting in this:
<p>This is a test sentence,<br/>here is a soft line break</p>
This is a test sentence,
here is a soft line break
One solution I thought of is to insert a span after the soft line break, containing a zero-width space, and then set the indentation for it again to achieve the desired effect:
<p>This is a test sentence,<br/><spanclass="break">​</span>here is a soft line break</p>
.break {
text-indent: 2em;
}
This is a test sentence,
here is a soft line break
Therefore, I want to use the character \n as a trigger and insert an ast.NewNodeKind("EachLineIndent") at the target position, which will later be rendered as <span class="break">​</span>.
Looking at the code, I found that any whitespace characters or line breaks are set to not trigger the parser, so I'm stuck :(
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In a webpage I wrote to display Markdown, I enabled hard line breaks and set first-line indentation for each paragraph:
However, current browsers cannot handle indentation for every line within the same paragraph, resulting in this:
One solution I thought of is to insert a span after the soft line break, containing a zero-width space, and then set the indentation for it again to achieve the desired effect:
Therefore, I want to use the character
\nas a trigger and insert anast.NewNodeKind("EachLineIndent")at the target position, which will later be rendered as<span class="break">​</span>.Looking at the code, I found that any whitespace characters or line breaks are set to not trigger the parser, so I'm stuck :(
goldmark/parser/parser.go
Lines 1175 to 1180 in afcb7ff
Any suggestions? (Or ideas for improvement?)
Beta Was this translation helpful? Give feedback.
All reactions