saberland/saber

Feature request: Expose line number index for color highlighting #600

Apostolique posted onGitHub

<!-- Please don't delete this template or we'll close your issue -->

<!-- Before creating an issue please make sure you are using the latest version of Saber. -->

Feature request

<!-- Please ask questions via following several ways. -->

<!-- https://chat.saber.land/ -->

<!-- https://stackoverflow.com/questions/ask?tags=saberjs -->

What problem does this feature solve?

It makes it possible to start the lines numbers to something else than 1.

What does the proposed API look like?

Exposed in a similar way to the current line highlighting in the markdown.

How should this be implemented in your opinion?

https://github.com/saberland/saber/blob/ec2cbac5a093edbe7454f14a0cfd1af6276c1ab3/packages/saber/src/markdown/highlight-plugin.js#L66

Are you willing to work on this yourself?

I could if no one else does.


We are using CSS counters in saber-highlight-css:

https://github.com/saberland/saber/blob/ec2cbac5a093edbe7454f14a0cfd1af6276c1ab3/packages/saber-highlight-css/default.css#L74

So probably we should inline that style into this line instead:

https://github.com/saberland/saber/blob/ec2cbac5a093edbe7454f14a0cfd1af6276c1ab3/packages/saber/src/markdown/highlight-plugin.js#L14

Like this:

<span 
  aria-hidden="true" 
  class="saber-highlight-line-numbers" 
  style="counter-reset: linenumber 0">

And make that 0 customizable.

posted by egoist almost 5 years ago

Fund this Issue

$0.00
Funded

Pull requests