Skip to content

iradkotton/lab.gtihub-markdown-big-doc-header-name-uniqueness-dilemma-2020-09-05

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 100.0%