Markdown.ToHeadingAnchor Method
- Namespace
- Kampute.DocToolkit.Support
- Assembly
- Kampute.DocToolkit.dll
Definition
Converts the specified heading text to the anchor that GitHub and GitLab generate for a Markdown heading.
public static string ToHeadingAnchor(string heading)Parameters
headingstring- The text of the heading.
Returns
- string
- The anchor of the heading, without the leading '#'.
Exceptions
- ArgumentNullException
- Thrown when
headingisnull.

- All characters are converted to lowercase.
- All characters except letters, numbers, hyphens, underscores and spaces are removed.
- Each space is converted to a hyphen.
For example, the headingRepeat<TResult>(TResult, int)has the anchorrepeattresulttresult-int.