davidmogar / gitbook-plugin-code Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi! I am using this plugin to get line numbers in my book code samples, and I ran into an issue.
When faced with this kind of code:
```python
"""Usage:
whatever
"""
```
Markdown will be converted into this (by the highlight plugin?):
<span class="hljs-string">"""
Usage:
whatever
""""</span>
And then when your plugin tries to wrap lines in code-line spans, things break because opening/closing tags don't match anymore:
<span class="code-line"><span class="hljs-string">"""</span>
<span class="code-line">Usage:</span>
<span class="code-line">whatever</span>
<span class="code-line">""""</span></span>
The effect is that the whole thing is only counted as one line.
It doesn't look easy to fix, it would need to keep track of open spans and close them then reopen them in the next line?
Something like the following would be nice, if possible:
```yaml,no_copy
foo: bar
...
Something like the following, if possible:
```yaml,line_num_start=5
5: foo: bar
6: ...
Where the line numbers start at the specified value, 5
, instead of 1.
Combined with #5 we could get something like:
```yaml,line_nums,line_num_start=5
5: foo: bar
Which would force line numbers to be rendered even though it is a one-line and start the line numbers at the specified value.
This is useful when you are dissecting a code-block line-by-line, for example, and want to make the context clearly known.
Something like the following, if possible:
```yaml,line_nums
foo: bar
Ideally that would render the line number even though it is a one-liner.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.