Skip to content

Commit

Permalink
Merge pull request #745 from phpDocumentor/bugfix/code-block-tab
Browse files Browse the repository at this point in the history
[BUGFIX] Allow tabs in line indentations
  • Loading branch information
jaapio authored Dec 12, 2023
2 parents 772dac5 + 2943901 commit 5229047
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public static function isBlockLine(string|null $line, int $minIndent = 1): bool
*/
public static function isIndented(string $line, int $minIndent): bool
{
return mb_strpos($line, str_repeat(' ', max(1, $minIndent))) === 0;
return self::isIndentedBy($line, $minIndent, ' ') || self::isIndentedBy($line, $minIndent, "\t");
}

private static function isIndentedBy(string $line, int $minIndent, string $indentationChar): bool
{
return mb_strpos($line, str_repeat($indentationChar, max(1, $minIndent))) === 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- content start -->
<div class="section" id="underscores-in-code-indented-with-tabs">
<h1>Underscores in code indented with tabs</h1>

<pre><code class="language-typoscript">split {
token = frontend__
1.current = 1
1.wrap = |
}</code></pre>
</div>

<!-- content end -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Underscores in code indented with tabs
======================================

.. code-block:: typoscript
split {
token = frontend__
1.current = 1
1.wrap = |
}

0 comments on commit 5229047

Please sign in to comment.