Skip to content

Instantly share code, notes, and snippets.

@rodolfoap
Last active August 25, 2023 12:35
Show Gist options
  • Save rodolfoap/6cd714a65a891c6fe699ab91f0d22384 to your computer and use it in GitHub Desktop.
Save rodolfoap/6cd714a65a891c6fe699ab91f0d22384 to your computer and use it in GitHub Desktop.
Gitlab numbering

CSS Numbering for Gitlab markdown Wiki

A css for numbering wiki titles

Usage

  1. Put the file custom.css at the root of your wiki repository and commit the file.
  2. If you need a table of contents, add the [[_TOC_]] tag in the wiki markdown:
# Main Title

## Contents

[[_TOC_]]

## Introduction
...
  1. Launch Gollum with the --css option:
docker run -d -p 80:4567 -v ${MY_WIKI_DIR}:/wiki gollumwiki/gollum:master --css
body {
counter-reset: h1
}
h1 {
counter-reset: h2
}
h2 {
counter-reset: h3
}
h3 {
counter-reset: h4
}
h1:not(.header-title)::before {
counter-increment: h1;
content: counter(h1) ". "
}
h2:before {
counter-increment: h2;
content: counter(h1) "." counter(h2) ". "
}
h3:before {
counter-increment: h3;
content: counter(h1) "." counter(h2) "." counter(h3) ". "
}
h4:before {
counter-increment: h4;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". "
}
ul {
counter-reset: section;
list-style-type: none;
}
ul li {
position: relative;
}
ul li::before {
counter-increment: section;
content: counters(section, ".") ". ";
}
ul ul li::before {
content: counters(section, ".") ". ";
}
ul ul {
counter-reset: section;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment