Skip to content

Instantly share code, notes, and snippets.

View hanh090's full-sized avatar

Hanh Le hanh090

  • Ho Chi Minh City
View GitHub Profile
@gotofritz
gotofritz / gitlab-markdown-toc.js
Last active May 7, 2019 12:50
creates a gitlab markdown table of contents for a README.md page
// quick and dirty snippet to creates a gitlab markdown table of contents for a README.md page
// preview gitlab page and paste in browser console
var str = "";
$('.file-content')
.find('h1, h2, h3, h4, h5, h6, h7')
.each((i, node) => {
// node.tagName is H1 H2...
let indent = Number(node.tagName[1]) - 1;
// markdown mested lists are
// - xxx