Git Product home page Git Product logo

lab.gtihub-markdown-big-doc-header-name-uniqueness-dilemma-2020-09-05's Introduction

the problem

  • you want to have a very large document, but avoid header names collision
  • painfully, github's markdown/rst/asciidoc do not allow to give a header a custom anchor id/link
  • so, if you have
## some header

or

== some header

or

***
some header
  • you are stuck with github.com/link-to-doc#some-header
  • you cannot use raw <h2 id="different-anchor">some-header</h2> either, it still gets replaced with #some-header

the hash approach/solution


## First heading <sup><sup><sub>2020-09-05 <a name="235ffda" href="#235ffda">235ffda</a></sub></sup></sup> 
  • renders as

First heading 2020-09-05 235ffda


  • use headers freely, but append to each
 <sup><sup><sub>2020-09-05 <a name="235ffda" href="#235ffda">235ffda</a></sub></sup></sup> 
  • where a random hash gives any header uniqueness
  • yes, it is a little taxing code-wise, but:
    • you get standard readable links to your header still, but with hash appended
    • if you rename the header and link breaks, user can use hash from old link to find the same header, but with new title
    • because hash of every header in the documnet never-ever changes, HOORAY!
    • or: hash itself is a link(anchor) and user can copy that link, which will never break
  • at the cost of having a small superscript over every header, you get header-name-freedom and unique persistent links
  • best of both worlds - auto generated header link and unique persisten hash for every single header

test

My Header Name

  • ad
  • ff

First heading 2020-09-05 4dsdwd1c

  • some blue text.
  • a
  • b

First heading 2020-09-05 53cf31

  • some blue text.
  • a
  • b

First heading 2020-09-05 4dsdwd1c

  • some blue text.
  • a
  • b

First heading 2020-09-05 7vwergv

  • some blue text.
  • a
  • b

First heading link

  • a
  • b

First heading 3y2ud

  • a
  • b

First heading 35tuh

  • a
  • b

First heading 32jfd

  • a
  • b

First heading 8743hf

  • a
  • b

First heading 67123d

  • a
  • b

First heading 783fh

  • a
  • b

Second heading

  • 1
  • 2
# Second heading

heading

  • a
  • a

First heading #

  • a
  • b

Second heading

  • a
  • c

Install-qwe

  • 1
  • 2

Install-qwe

  • 1
  • 2

Install-qwe

  • wer
  • rtgrq
  • 1
  • 2

Install

blah blah

Heading123

  • asd
  • few

Heading

  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar

Heading

  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar
  • foo
  • bar

lab.gtihub-markdown-big-doc-header-name-uniqueness-dilemma-2020-09-05's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.