pimd icon indicating copy to clipboard operation
pimd copied to clipboard

Add IDs and anchors to headings

Open hagenburger opened this issue 6 years ago • 0 comments

Write a plugin that adds IDs and anchors to headings.

Example

Input:

# Lorem ipsum

Output:

<h1><a href="#lorem-ipsum"><span id="lorem-ipsum"></span></a>Lorem ipsum</h1>

Background

  • The extra <span> allows manipulating the scroll position (for example when there’s a fixed navigation, this avoids that the headline is hidden behind it)
  • The <a> should be visible on hover and display a #, link icon or anchor icon (depending on the theme)
  • This might need to have an additional hook which gets called in renderInline()

hagenburger avatar Oct 10 '18 21:10 hagenburger