Class HeaderAnchorGenerator
- java.lang.Object
-
- net.sf.okapi.filters.markdown.parser.HeaderAnchorGenerator
-
public class HeaderAnchorGenerator extends Object
-
-
Constructor Summary
Constructors Constructor Description HeaderAnchorGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgenerateAnchorText(String text)Convert header text to an anchor id, following the steps described in https://docs.gitlab.com/ee/user/markdown.html#header-ids-and-links: 1.
-
-
-
Method Detail
-
generateAnchorText
public String generateAnchorText(String text)
Convert header text to an anchor id, following the steps described in https://docs.gitlab.com/ee/user/markdown.html#header-ids-and-links: 1. All text is converted to lowercase. 2. All non-word text (such as punctuation or HTML) is removed. (Note: our implementation treats underscore as a "word" character.) 3. All spaces are converted to hyphens. 4. Two or more hyphens in a row are converted to one. 5. If a header with the same ID has already been generated, a unique incrementing number is appended, starting at 1.- Returns:
- the generated anchor id, not including the surrounding markup (braces)
-
-