In GitHub's markdown we can create an anchor to any heading, like the example below:
# Heading 1
Click [here](#heading-2) to go to the second heading
# Heading 2
This is the second heading :)
The problem is that I couldn't find the rules to convert the text in the heading (in this case "Heading 2") to the fragment identifier (in this case heading-2). There are some non-intuitive behaviors, like some characters getting omitted and accented letters not changing to their non-accented versions ("Á!á?É!é?" would be turned into ááéé, for example).
I want to automate this process so it would be really useful to see the rules for this conversion with all possible cases and exceptions.
Where can I find this information?