Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Crozzers
Copy link
Contributor

@Crozzers Crozzers commented Apr 8, 2022

The problem was that fenced code blocks would not be detected if placed inside a list (ul/ol) due to
the leading indentation before the opening code fence.
This PR tweaks the _fenced_code_block_re to ignore leading space/tab indents before an opening fence.

_code_block_sub has also been altered to maintain the leading indentation when inserting code hashes as
to not break the list (ul/ol) that the fenced code block is in, so instead of this:

<h2>URL PARAMETERS IN THE TEMPLATE</h2>

<ul>
<li>All views (except <code>md5-e492587862bc07a3e8a1766f3b6cdf9f</code>) from <code>md5-13862f106a0084500eb9518428d220d5</code> inherit from <code>md5-cb5cca48ea3a39d2e5f4f32ed57fe64e</code></li>
<li><code>md5-cb5cca48ea3a39d2e5f4f32ed57fe64e</code> defines the method <code>md5-e7f43ed59796b5da4b301f5cdc8ee0d1</code>:</li>
</ul>

md5-9b355e37bf17872e1d8fa0ef265c0b94


    So when overriding one must be careful to extends `super`'s `kwargs`:


md5-e6db16759f697cd8b6f6220aaa2a9f78

The output HTML looks more like this:

<h2>URL PARAMETERS IN THE TEMPLATE</h2>

<ul>
<li>All views (except <code>md5-e492587862bc07a3e8a1766f3b6cdf9f</code>) from <code>md5-13862f106a0084500eb9518428d220d5</code> inherit from <code>md5-cb5cca48ea3a39d2e5f4f32ed57fe64e</code></li>
<li><code>md5-cb5cca48ea3a39d2e5f4f32ed57fe64e</code> defines the method <code>md5-e7f43ed59796b5da4b301f5cdc8ee0d1</code>:

    md5-9b355e37bf17872e1d8fa0ef265c0b94


    <p>So when overriding one must be careful to extends `super`'s `kwargs`:</p>


    md5-e6db16759f697cd8b6f6220aaa2a9f78
</li></ul>

The problem was that fenced code blocks would not be detected if placed inside a list (ul/ol) due to
the leading indentation before the opening code fence.
This commit tweaks the `_fenced_code_block_re` to ignore leading space/tab indents before an opening fence.

`_code_block_sub` has also been altered to maintain the leading indentation when inserting code hashes as
to not break the list (ul/ol) that the fenced code block is in.
@nicholasserra
Copy link
Collaborator

Thanks!

@nicholasserra nicholasserra merged commit 975380d into trentm:master Apr 8, 2022
@Crozzers Crozzers deleted the fix-issue-426 branch April 8, 2022 19:47
@Crozzers Crozzers restored the fix-issue-426 branch April 10, 2022 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants