All Projects → Flet → markdown-it-github-headings

Flet / markdown-it-github-headings

Licence: ISC license
Add anchors and links to headings just like Github does

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to markdown-it-github-headings

Remarkable
Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one. Gulp and metalsmith plugins available. Used by Facebook, Docusaurus and many others! Use https://github.com/breakdance/breakdance for HTML-to-markdown conversion. Use https://github.com/jonschlinkert/markdown-toc to generate a table of contents.
Stars: ✭ 5,252 (+23772.73%)
Mutual labels:  commonmark, markdown-it
motion-markdown-it
Ruby/RubyMotion version of Markdown-it (CommonMark compliant parser and extendable)
Stars: ✭ 42 (+90.91%)
Mutual labels:  commonmark, markdown-it
Tui.editor
🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
Stars: ✭ 14,016 (+63609.09%)
Mutual labels:  commonmark
markdown
The first generation of Markdown rendering for R (born in 2012). Now R Markdown usually means the *r*markdown package instead of *markdown*. The repo for the former is at https://github.com/rstudio/rmarkdown
Stars: ✭ 64 (+190.91%)
Mutual labels:  commonmark
table-link
📂 The easiest way to add links in your table rows, cells or elements that are not anchors!
Stars: ✭ 25 (+13.64%)
Mutual labels:  anchor
Markdownui
Render Markdown text in SwiftUI
Stars: ✭ 207 (+840.91%)
Mutual labels:  commonmark
react-use-downloader
Creates a download handler function and gives progress information
Stars: ✭ 65 (+195.45%)
Mutual labels:  anchor
Commonmark
Highly-extensible PHP Markdown parser which fully supports the CommonMark and GFM specs.
Stars: ✭ 2,128 (+9572.73%)
Mutual labels:  commonmark
menote
A simple, beautiful Markdown editor powered by vue.js, ace, markdown-it. ✨
Stars: ✭ 56 (+154.55%)
Mutual labels:  markdown-it
Lute
🎼 一款对中文语境优化的 Markdown 引擎,支持 Go 和 JavaScript。A structured Markdown engine that supports Go and JavaScript.
Stars: ✭ 222 (+909.09%)
Mutual labels:  commonmark
anchor-escrow
Escrow program implemented in Anchor
Stars: ✭ 142 (+545.45%)
Mutual labels:  anchor
Markdownlint
A Node.js style checker and lint tool for Markdown/CommonMark files.
Stars: ✭ 2,828 (+12754.55%)
Mutual labels:  commonmark
Lute
🎼 一款结构化的 Markdown 引擎,支持 Go 和 JavaScript。
Stars: ✭ 211 (+859.09%)
Mutual labels:  commonmark
koino
CommonMark + GFM compatible Markdown parser and renderer
Stars: ✭ 81 (+268.18%)
Mutual labels:  commonmark
Vditor
♏ 一款浏览器端的 Markdown 编辑器,支持所见即所得(富文本)、即时渲染(类似 Typora)和分屏预览模式。An In-browser Markdown editor, support WYSIWYG (Rich Text), Instant Rendering (Typora-like) and Split View modes.
Stars: ✭ 3,773 (+17050%)
Mutual labels:  commonmark
Markdown
CommonMark-compliant markdown parser and renderer in Go. This repository has moved to https://gitlab.com/golang-commonmark/markdown
Stars: ✭ 180 (+718.18%)
Mutual labels:  commonmark
Commonmark.py
Python CommonMark parser
Stars: ✭ 215 (+877.27%)
Mutual labels:  commonmark
autobadge
Simple CLI tool to generate essential repository badges with ease
Stars: ✭ 16 (-27.27%)
Mutual labels:  markdown-it
markdig.wpf
A WPF library for xoofx/markdig https://github.com/xoofx/markdig
Stars: ✭ 133 (+504.55%)
Mutual labels:  commonmark
tw5-markdown
Comprehensive Markdown plugin for TiddlyWiki
Stars: ✭ 26 (+18.18%)
Mutual labels:  markdown-it

markdown-it-github-headings

Add GitHub style anchor tags to headers

npm travis standard

Install

npm install markdown-it-github-headings

Usage

var md = require('markdown-it')()
  .use(require('markdown-it-github-headings'), options)

Options and Defaults

The defaults will make the heading anchors behave as close to how GitHub behaves as possible.

Name Description Default
className name of the class that will be added to the anchor tag anchor
prefixHeadingIds add a prefix to each heading ID. (see security note below) true
prefix if prefixHeadingIds is true, use this string to prefix each ID. user-content-
enableHeadingLinkIcons Adds the icon next to each heading true
linkIcon If enableHeadingLinkIcons is true, use this to supply a custom icon (or anything really)
resetSlugger reset the slugger counter between .render calls for duplicate headers. (See tests for example) true

Why should I prefix heading IDs?

When using user generated content, its possible to run into DOM Clobbering when heading IDs are generated. Since IDs are used by JavaScript and CSS, a user could craft a page that breaks functionality or styles. A good way to avoid clobbering is to add a prefix to every generated ID to ensure they cannot overlap with existing IDs.

If you have full control over the content, there is less of a risk, but be aware that strange bugs related to DOM Clobbering are still possible!

For more information, here are some good resources on the topic:

But the prefixes make links look real gross.

One solution is to write some client side JavaScript to force non-prefixed hashes to jump to prefixed anchors. This is how its handled on GitHub and npmjs.com.

Check out marky-deep-links for an example (works great with browserify or webpack).

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].