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 optional leading whitespace highlighting #2584

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AgentHagu
Copy link

@AgentHagu AgentHagu commented Jan 17, 2025

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
This PR closes #2573. In summary, it allows users to now optionally highlight leading whitespace, giving them more options when using MarkBind.

Users can now add an optional + after their highlight index specifier to indicate that the index should be inclusive of leading whitespace. For example, previously 1[:4] would highlight the abcd in abcd. But now, by using 1[:4]+, MarkBind will highlight ab in abcd (i.e. it will also highlight the first 2 spaces in the string).

Anything you'd like to highlight/discuss:
nil

Testing instructions:
A test similar to the example brought up in #2573 can be used to test the new functionality. For example:

```{highlight-lines="1[:4]"}
  abcd
```

abcd should be highlighted, i.e. exclusive of the 2 whitespaces in the beginning.

```{highlight-lines="1[:4]+"}
  abcd
```

Now, ab should be highlighted, since the "+" symbol was added, so leading whitespaces are included in the bounds calculation.

Proposed commit message: (wrap lines at 72 characters)
Add optional leading whitespace highlighting

Currently, there is no way to include highlighting of leading
whitespace when using the highlight-lines attribute. Providing such
an option may be beneficial to users, giving them more freedom
when using MarkBind.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

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.

Highlighting code blocks: leading spaces should be counted
1 participant