diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-08-05 17:44:13 +0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-08-06 09:32:29 +0800 |
commit | 46631e102366bd40bdb449b87fae3f10e992ee68 (patch) | |
tree | 7dd1ffe71cc632f8175c291638ff35d1f40613e3 /lib/rouge | |
parent | fa216b0e86433192ba4e39a05f42217fb4685173 (diff) | |
download | gitlab-ce-46631e102366bd40bdb449b87fae3f10e992ee68.tar.gz |
Support selective highlighting of lines65152-selective-highlight
Instead of highlighting all lines when not all of them are
needed, only highlight specific lines.
The `BlobPresenter#highlight` method has been updated to
support `since` and `to` params. These params will be used to
limit the content to be highlighted.
Modify `Gitlab::Highlight` to support `since` param which will
then be used to determine the starting line number.
Diffstat (limited to 'lib/rouge')
-rw-r--r-- | lib/rouge/formatters/html_gitlab.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb index e2a7d3ef5ba..0d4ac504428 100644 --- a/lib/rouge/formatters/html_gitlab.rb +++ b/lib/rouge/formatters/html_gitlab.rb @@ -8,8 +8,8 @@ module Rouge # Creates a new <tt>Rouge::Formatter::HTMLGitlab</tt> instance. # # [+tag+] The tag (language) of the lexer used to generate the formatted tokens - def initialize(tag: nil) - @line_number = 1 + def initialize(tag: nil, since: nil) + @line_number = since || 1 @tag = tag end |