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 enable_line_numbers, start_line_numbers_at and highlight_lines_extra in code blocks #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TitovLab
Copy link
Contributor

Add support for enable_line_numbers, start_line_numbers_at and highlight_lines_extra in code blocks.
It is a correct version of pull request #109

Logic of start_line_numbers_at field:

  1. The field accepts integer values - fractional values will be converted to integer values, non-numeric values - discarded.
  2. The positive value sets enable_line_numbers="true".
  3. An undefined value sets enable_line_numbers="false".

Logic of highlight_lines_extra field:

  1. The field accepts a single integer value or a set of integer values separated by a comma - fractional values will be converted to integers, not numeric values - discarded.
  2. The field is automatically recalculated when you switch to Prosemirror editor or preview from Prosemirror editor.
  3. If a set of values is specified in the field, they will be sorted in ascending order.
  4. The possibility to specify relative values has been implemented - if, for example, we have a certain piece of code, the numbering of which starts with 37 lines, and we need to highlight the 53rd and 68th lines of code, then in the field we type: "53,68" (without quotes). In the standard DokuWiki editor we will still have absolute values.
  5. The ability to specify absolute values, as implemented in the standard DokuWiki editor is also saved - for this we specify negative values. I.e. to highlight, for example, 4 and 7 code stacks, no matter from which line our code begins to number - specify in the field: "-4,-7" (without quotes).
  6. If the field start_line_numbers_at is not specified, the numbering will be the same as in the standard DokuWiki editor, i.e. starting with 1.

…ght_lines_extra in code blocks.

Logic of start_line_numbers_at field:
1. The field accepts integer values - fractional values will be converted to integer values, non-numeric values - discarded.
2. The positive value sets enable_line_numbers="true".
3. An undefined value sets enable_line_numbers="false".

Logic of highlight_lines_extra field:
1. The field accepts a single integer value or a set of integer values separated by a comma - fractional values will be converted to integers, not numeric values - discarded.
2. The field is automatically recalculated when you switch to Prosemirror editor or preview from Prosemirror editor.
3. If a set of values is specified in the field, they will be sorted in ascending order.
4. The possibility to specify relative values has been implemented - if, for example, we have a certain piece of code, the numbering of which starts with 37 lines, and we need to highlight the 53rd and 68th lines of code, then in the field we type: "53,68" (without quotes). In the standard DokuWiki editor we will still have absolute values.
5. The ability to specify absolute values, as implemented in the standard DokuWiki editor is also saved - for this we specify negative values. I.e. to highlight, for example, 4 and 7 code stacks, no matter from which line our code begins to number - specify in the field: "-4,-7" (without quotes).
6. If the field start_line_numbers_at is not specified, the numbering will be the same as in the standard DokuWiki editor, i.e. starting with 1.
@annda
Copy link
Contributor

annda commented Jul 27, 2020

Thanks for submitting. Please see the build error message and fix the code style errors. There are currently no code style checks for PHP, but the formatting should be corrected as well (check the braces).

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.

2 participants