frnmst / md-toc

Automatically generate and add an accurate table of contents to markdown files.
https://docs.franco.net.eu.org/md-toc/
GNU General Public License v3.0
30 stars 5 forks source link

Links not working when some styling is used in the header on GitHub #25

Open flyte opened 3 years ago

flyte commented 3 years ago

Here I've used <small> and _ styling: https://github.com/flyte/pi-mqtt-gpio/blob/d49d599c6f2f04ba0c6c31c214fd0f49746cc170/config-doc.md

Here I've only used the _ styling: https://github.com/flyte/pi-mqtt-gpio/blob/e9be6b2056a2bedca8189729abd15e7ed645b839/config-doc.md

And here I've removed the _ styling and it works: https://github.com/flyte/pi-mqtt-gpio/blob/c9227fc9bc3abc2e87cb02a034acaa7b972fd60f/config-doc.md

frnmst commented 3 years ago

Hi,

have you got any documentational reference for the use of <small> and _. I can't find it in GFM

flyte commented 3 years ago

As far as <small> goes, it's not explicitly listed, but GFM allows HTML except for those tags on the blacklist.

Underscore for italics: https://guides.github.com/features/mastering-markdown/#syntax

frnmst commented 3 years ago

This might take a while to get fixed so here is another reference:

frnmst commented 3 years ago

You can test HTML tag filtering using the bugfix-issue-25-anchor-header-links branch:

git clone https://github.com/frnmst/md-toc.git
git checkout bugfix-issue-25-anchor-header-links
make install-dev
wget https://github.com/flyte/pi-mqtt-gpio/blob/d49d599c6f2f04ba0c6c31c214fd0f49746cc170/config-doc.md
pipenv run python -m md_toc github config-doc.md

I still need to write the unit tests and documentation. Afterwards it will be the turn of https://spec.commonmark.org/0.28/#emphasis-and-strong-emphasis

frnmst commented 3 years ago

Here is what I get with the current dev of md-toc. Some parts concerning the emphasis removal have not yet been implemented and will not be released in md-toc version 7.2.0, specifically rule 16 and 17 in https://spec.commonmark.org/0.28/#emphasis-and-strong-emphasis

https://github.com/flyte/pi-mqtt-gpio/blob/d49d599c6f2f04ba0c6c31c214fd0f49746cc170/config-doc.md

$ pipenv run python -m md_toc github -l6 config-doc.md`

- [MQTT IO Configuration](#mqtt-io-configuration)
- [`mqtt`](#mqtt)
  - [<small>_mqtt_.</small>`tls`](#mqtttls)
- [`gpio_modules`](#gpio_modules)
- [`sensor_modules`](#sensor_modules)
- [`stream_modules`](#stream_modules)
- [`digital_inputs`](#digital_inputs)
  - [<small>_digital_inputs.*_.</small>`ha_discovery`](#digital_inputsha_discovery)
- [`digital_outputs`](#digital_outputs)
  - [<small>_digital_outputs.*_.</small>`ha_discovery`](#digital_outputsha_discovery)
- [`sensor_inputs`](#sensor_inputs)
  - [<small>_sensor_inputs.*_.</small>`ha_discovery`](#sensor_inputsha_discovery)
- [`logging`](#logging)