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 support for line numbers in code blocks #112

Merged
merged 6 commits into from
Dec 20, 2019

Conversation

allejo
Copy link
Member

@allejo allejo commented Dec 20, 2019

Summary

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed issues Closes #105

Description

Adds the ability to start highlighting specific lines in code blocks. Here's the implemented syntax.

  • lang - Don't highlight any lines
  • lang{4} - Highlight just line 4
  • lang{4-6} - Highlight the range of lines from 4 to 6 (inclusive)
  • lang{1,5} - Highlight just lines 1 and 5 on their own
  • lang{1-3,5} - Highlight 1 through 3 and then 5 on its own
  • lang{5,7,2-3} - The order of lines don't matter
    • However, specifying 3-2 will not work.

This also adds the new highlighter.line_numbers configuration file option that will allow users to opt-in to displaying line numbers for all code blocks.

This feature has been added to both the Markdown and RST engines.

Check List

  • Added appropriate PhpDoc for modifications
  • Added unit test to ensure fix works as intended

@allejo allejo added Feature: Implementation A tag for PRs to signify it's implementing a new feature Core: Non-breaking This is a small change to the project's internal; can be planned for minor releases In Review A PR that's ready to be reviewed and tested labels Dec 20, 2019
@allejo allejo removed the In Review A PR that's ready to be reviewed and tested label Dec 20, 2019
@allejo allejo merged commit b10dd39 into develop Dec 20, 2019
@allejo allejo deleted the feature/number-highlighting branch December 20, 2019 05:47
@allejo allejo added this to the v0.2.1 milestone Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: Non-breaking This is a small change to the project's internal; can be planned for minor releases Feature: Implementation A tag for PRs to signify it's implementing a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for line highlighting in code blocks
1 participant