xref: /llvm-project/llvm/docs/llvm_slug.py (revision 6989c4842f66af5c9c4ec927ce556274710f6688)
1# -*- coding: utf-8 -*-
2#
3# LLVM documentation anchor slug formatting
4
5# Some of our markdown documentation numbers section titles
6# This helpers is used by myst to remove that numbering from the anchor links.
7
8from docutils.nodes import make_id
9
10
11def make_slug(str):
12    import re
13
14    str = re.sub(r"^\s*(\w\.)+\w\s", "", str)
15    str = re.sub(r"^\s*\w\.\s", "", str)
16    return make_id(str)
17