Skip to content

Commit

Permalink
[FEATURE] Create a rst theme to convert markdown
Browse files Browse the repository at this point in the history
Convert basic mark-down into restructured Text

* blockquote
  • Loading branch information
linawolf committed Oct 11, 2024
1 parent aefca48 commit f8a63b0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/guides-theme-rst/src/RstTheme/Twig/RstExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
use Twig\TwigFilter;
use Twig\TwigFunction;

use function array_map;
use function explode;
use function implode;
use function min;
use function preg_replace;
use function rtrim;
use function str_repeat;
use function strlen;

Expand Down Expand Up @@ -59,12 +64,14 @@ public function cleanContent(string $content): string
$content = implode("\n", $lines);

$content = preg_replace('/(\n){2,}/', "\n\n", $content);
return rtrim($content)."\n";

return rtrim($content) . "\n";
}

public function renderRstIndent(string $text, int $indentNr): string
{
$indent = str_repeat(' ', $indentNr*4);
$indent = str_repeat(' ', $indentNr * 4);

return preg_replace('/^/m', $indent, $text);
}

Expand Down

0 comments on commit f8a63b0

Please sign in to comment.