https://github.com/digitalmoksha/markdown-it-inject-linenumbers
Insert line numbers to support sync scrolling for the markdown-it parser.
https://github.com/digitalmoksha/markdown-it-inject-linenumbers
markdown-it plugin
Last synced: about 1 year ago
JSON representation
Insert line numbers to support sync scrolling for the markdown-it parser.
- Host: GitHub
- URL: https://github.com/digitalmoksha/markdown-it-inject-linenumbers
- Owner: digitalmoksha
- License: mit
- Created: 2017-03-01T10:10:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-17T20:56:42.000Z (over 3 years ago)
- Last Synced: 2025-04-04T20:38:27.379Z (about 1 year ago)
- Topics: markdown-it, plugin
- Language: Makefile
- Homepage:
- Size: 11.7 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# markdown-it-inject-linenumbers
> Insert line numbers to support sync scrolling for the [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser.
Inject the source line numbers into the final HTML. This gives you the anchor points to implement synchronized scrolling.
`lorem` => `
lorem
`
Inline elements are not supported. Only the following block level elements are currently supported:
- headings
- paragraphs
- list items
- tables
_This plugin was built using the [markdown-it demo](https://github.com/markdown-it/markdown-it/tree/master/support/demo_template) sync scrolling as a starting point._
## Install
node.js, browser:
```bash
npm install markdown-it-inject-linenumbers --save
bower install markdown-it-inject-linenumbers --save
```
## Use
```js
var md = require('markdown-it')()
.use(require('markdown-it-inject-linenumbers'));
md.render('lorem') // => '
lorem
'
```
_Differences in browser._ If you load script directly into the page, without
package system, module will add itself globally as `window.markdownitInjectLinenumbers`.
## License
[MIT](https://github.com/digitalmoksha/markdown-it-inject-linenumbers/blob/master/LICENSE)