Skip to content

Reference

takumisoft68 edited this page Aug 14, 2021 · 3 revisions

Azure DevOps

https://docs.microsoft.com/en-us/azure/devops/project/wiki/markdown-guidance?view=azure-devops#anchor-links

Within Markdown files, anchor IDs are assigned to all headings when rendered as HTML.
The ID is the heading text, with the spaces replaced by dashes (-) and all lower case.
In general, the following conventions apply:

  • Punctuation marks and leading white spaces within a file name are ignored
  • Upper case letters are converted to lower
  • Spaces between letters are converted to dashes (-).

GitHub

https://gist.github.com/asabaylus/3071099#gistcomment-3163739

  • Convert to lowercase letters
  • Replace each space with '-'
  • Remove punctuations other than "-" and "_"
  • Remove CJK punctuations
function GithubId(val) {
	return val.toLowerCase().replace(/ /g,'-')
		// single chars that are removed
		.replace(/[`~!@#$%^&*()+=<>?,./:;"'|{}\[\]\\]/g, '')
		// CJK punctuations that are removed
		.replace(/[ ]/g, '')
}

GitLab

https://docs.gitlab.com/ee/user/markdown.html#header-ids-and-links

Header IDs and links

GitLab Flavored Markdown extends the standard Markdown standard so that all Markdown-rendered headers automatically get IDs, which can be linked to, except in comments. On hover, a link to those IDs becomes visible to make it easier to copy the link to the header to use it somewhere else. The IDs are generated from the content of the header according to the following rules:

  • All text is converted to lowercase.
  • All non-word text (such as punctuation or HTML) is removed.
  • All spaces are converted to hyphens.
  • Two or more hyphens in a row are converted to one.
  • If a header with the same ID has already been generated, a unique incrementing number is appended, starting at 1.

Clone this wiki locally