类 HeadingAnchorExtension

  • 所有已实现的接口:
    org.commonmark.Extension, org.commonmark.renderer.html.HtmlRenderer.HtmlRendererExtension

    public class HeadingAnchorExtension
    extends java.lang.Object
    implements org.commonmark.renderer.html.HtmlRenderer.HtmlRendererExtension
    Extension for adding auto generated IDs to headings.

    Create it with create() or builder() and then configure it on the renderer builder (HtmlRenderer.Builder.extensions(Iterable)).

    The heading text will be used to create the id. Multiple headings with the same text will result in appending a hyphen and number. For example:

    
     # Heading
     # Heading
     
    will result in
    
     <h1 id="heading">Heading</h1>
     <h1 id="heading-1">Heading</h1>
     
    另请参阅:
    the IdGenerator class if just the ID generation part is needed
    • 方法详细资料

      • create

        public static org.commonmark.Extension create()
        返回:
        the extension built with default settings
      • extend

        public void extend​(org.commonmark.renderer.html.HtmlRenderer.Builder rendererBuilder)
        指定者:
        extend 在接口中 org.commonmark.renderer.html.HtmlRenderer.HtmlRendererExtension