Feature/codelines: Add support for numbering source code lines#51
Open
ljrk0 wants to merge 5 commits intogreg42:masterfrom
Open
Feature/codelines: Add support for numbering source code lines#51ljrk0 wants to merge 5 commits intogreg42:masterfrom
ljrk0 wants to merge 5 commits intogreg42:masterfrom
Conversation
We add three more properties to the `source element` of the format
[source firstnumber=N, range="a-b,c-d", numbers=Bool]
The `firstnumber` determines how we remap the first actual input line.
By default this is the identity, that is, the first input line is set as
first line in the output: `firstnumber=0`.
The range specifies what parts of the code we want to print.
It depends on the value of `firstnumber`, that is, if we use `firstnumber=10` and
`range 11-14` it will print the 2st to 6nd (thx @aLuc) line of the input.
By default all lines are printed.
Finally, we can turn line numbers on or off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We add three more properties to the
source elementof the formatThe
firstnumberdetermines how we remap the first actual input line.By default this is the identity, that is, the first input line is set as
first line in the output:
firstnumber=0.The range specifies what parts of the code we want to print.
It depends on the value of
firstnumber, that is, if we usefirstnumber=10andrange 11-14it will print the 2st to 6nd (thx @aLuc) line of the input.By default all lines are printed.
Finally, we can turn line numbers on or off.
This PR also changes the following:
Monad.failand introducesMonadFailPipeline markup_secfault/pipelines/8981 passed.
Note on design: Since this simply prepends each line with a line number, highlighters will break. The "proper" way to fix this would probably to introduce an
ItemLineNoor the like and writing a specific renderer for each target (LO + HTML). This works for now, though.