Skip to content

Add support for CSS classes in code blocks #138

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 2 commits into from
Feb 10, 2022

Conversation

javiereguiluz
Copy link
Collaborator

In a Symfony book we have this RST code:

The workflow starts with the creation of a Git branch:

.. code-block:: terminal
    :class: hide

    $ git branch -D sessions-in-db || true

.. code-block:: terminal

    $ git checkout -b sessions-in-db

This command creates a ``sessions-in-db`` branch from the ``master`` branch. It "forks" the code and the infrastructure configuration.

The :class: hide attribute is important because that command should not be displayed to the book reader. Thus, we add the hide CSS class and hide that item on the webpage.

However, this doesn't work because the RST parser seems to not propagate CSS classes in code blocks. This PR tries to fix that, but it's not working. It contains a failing test in terminal.rst/ terminal.html files. Thanks!

@javiereguiluz
Copy link
Collaborator Author

Ryan, thanks a lot for fixing this error. You really know the parser well 🙇 Let's merge this!

@javiereguiluz javiereguiluz merged commit 4ec4b55 into symfony-tools:main Feb 10, 2022
@javiereguiluz javiereguiluz deleted the codeblock_class branch February 10, 2022 19:42
javiereguiluz added a commit that referenced this pull request Feb 10, 2022
…(javiereguiluz)

This PR was merged into the main branch.

Discussion
----------

Improve the handling of custom CSS classes in code blocks

This tweaks #138 a bit to avoid unnecessary white spaces.

Commits
-------

3b0db51 Improve the handling of custom CSS classes in code blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants