Skip to content

Process sidebar directive's titles as span nodes #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/docs.phar
/.env
/.phpunit.result.cache
/composer.lock
2 changes: 1 addition & 1 deletion src/Directive/SidebarDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function processSub(Parser $parser, ?Node $document, string $variable, st
$wrapperDiv = $parser->renderTemplate(
'directives/sidebar.html.twig',
[
'title' => $data,
'title' => $parser->createSpanNode($data)->render(),
]
);

Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/expected/blocks/directives/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<div class="admonition-wrapper"><div class="admonition admonition-sidebar"><p class="sidebar-title"><span>The sidebar's title</span></p><p>some text inside sidebar</p>
</div></div>

<div class="admonition-wrapper"><div class="admonition admonition-sidebar"><p class="sidebar-title"><span>More about the <code translate="no" class="notranslate">request()</code> Method</span></p><p>The full signature of the <code translate="no" class="notranslate">request()</code> method is...</p>
</div></div>
4 changes: 4 additions & 0 deletions tests/fixtures/source/blocks/directives/sidebar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
.. sidebar:: The sidebar's title

some text inside sidebar

.. sidebar:: More about the ``request()`` Method

The full signature of the ``request()`` method is...