Skip to content

Support :emphasize-lines: option in the code directive#14412

Open
armorbreak001 wants to merge 1 commit intosphinx-doc:masterfrom
armorbreak001:fix/code-directive-emphasize-lines
Open

Support :emphasize-lines: option in the code directive#14412
armorbreak001 wants to merge 1 commit intosphinx-doc:masterfrom
armorbreak001:fix/code-directive-emphasize-lines

Conversation

@armorbreak001
Copy link
Copy Markdown

Summary

The .. code::` directive rejected the `:emphasize-lines:` option with an "unknown option" error, even though the related `..` code-block::` directive supports it.

Details

Added emphasize-lines to the Code directive's option_spec and wired up the parsing logic (using the existing parse_line_num_spec helper) so that highlighted lines are passed through to the output node via highlight_args['hl_lines']. This matches the behavior of CodeBlock.

Fixes #14411

The .. code:: directive did not accept the :emphasize-lines:
option even though .. code-block:: does. This caused an unknown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

code directive doesn't treat emphasize-lines option the same way as code-block

1 participant