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
The HTML-in-markdown equivalent for codeblock markdowns like:
```javascriptconstone=1;
consttwo=2;
```
is:
<prelang="javascript"><code>const one = 1;
const two = 2;
</code></pre>
which is sensitive to whitespaces that's inside the <pre><code> tags.
For example, adding a 2-space indent to the tags like:
<prelang="javascript"><code>const one = 1;
const two = 2;
</code></pre>
renders as:
constone=1;consttwo=2;
instead of:
constone=1;consttwo=2;
Current related workarounds
Sometimes the HTML-syntax of codeblock is needed.
For example, inserting codeblocks in tables:
Codeblock in table
constone=1;consttwo=2;
which has a markdown (which is just all HTML) of:
<table><thead><tr><th>Codeblock in table</th></tr></thead><tbody><tr><td><prelang="javascript"><code>const one = 1;
const two = 2;
</code></pre></td></tr></tbody></table>
Notice how the codeblock-tags are completely unindented.
This is currently achieved by letting the rules indent the codeblock as they please, then unindent it via Regular Expression in the unindentCodeblocks post-process.
The problem
Given the below HTML, which is a tight-list with <p> tags in 2/3 of its list-items:
or perhaps the regex of the indent utility function could be change to indent all but the HTML-codeblocks.
But if the above target markdown is to be achieved without some convoluted regex-base workaround , some SIGNIFICANT OVERHAUL needs to be done on the handling of indents for HTML codeblocks.
The text was updated successfully, but these errors were encountered:
Context
Codeblock's HTML-in-markdown syntax
The HTML-in-markdown equivalent for codeblock markdowns like:
is:
which is sensitive to whitespaces that's inside the
<pre><code>
tags.For example, adding a 2-space indent to the tags like:
renders as:
instead of:
Current related workarounds
Sometimes the HTML-syntax of codeblock is needed.
For example, inserting codeblocks in tables:
which has a markdown (which is just all HTML) of:
Notice how the codeblock-tags are completely unindented.
This is currently achieved by letting the rules indent the codeblock as they please, then unindent it via Regular Expression in the
unindentCodeblocks
post-process.The problem
Given the below HTML, which is a tight-list with
<p>
tags in 2/3 of its list-items:The target markdown will have a mix of HTML and markdown syntax:
Notice how in this case, the
<pre><code>
tags of the codeblock is indented.Without this indent, the codeblock will be outside the list.
BUT, that indent cannot be achieved without affecting the current
unindentCodeblocks
post-process trick mentioned in theContext
section above.Solution?
The easiest way to fix this is to simply make the entire list use HTML-syntax, like:
or perhaps the regex of the
indent
utility function could be change to indent all but the HTML-codeblocks.But if the above target markdown is to be achieved without some convoluted regex-base workaround , some SIGNIFICANT OVERHAUL needs to be done on the handling of indents for HTML codeblocks.
The text was updated successfully, but these errors were encountered: