Skip to content
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

Add emphasize-lines directive to code blocks #3607

Closed
fvicent opened this issue Mar 24, 2022 · 1 comment · Fixed by #3611
Closed

Add emphasize-lines directive to code blocks #3607

fvicent opened this issue Mar 24, 2022 · 1 comment · Fixed by #3611

Comments

@fvicent
Copy link
Contributor

fvicent commented Mar 24, 2022

I suggest to add the emphasize-lines directive to code blocks, Sphinx-like. Emphasizing lines is an already supported feature in Pygments, so the implementation is trivial. I've already patched my local Nikola installation and it has been working fine. I can submit a PR with the proper tests if you are ok with this addition.

This is an example taken from the Sphinx docs of how it works:

.. code-block:: python
   :emphasize-lines: 3,5

   def some_function():
       interesting = False
       print('This line is highlighted.')
       print('This one is not...')
       print('...but this one is.')

Line ranges are also supported, such as:

   :emphasize-lines: 1-3,5-9,15
@ralsina
Copy link
Member

ralsina commented Apr 19, 2022

If you want to submit the PR that would be great!

@Kwpolska Kwpolska linked a pull request Apr 22, 2022 that will close this issue
3 tasks
Kwpolska added a commit that referenced this issue Apr 22, 2022
Implement emphasize-lines directive (#3607)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants