Heading auto identifier
This PR implement an extension when generating heading. This make possible to link directly to heading. Github, Pandoc and other Markdown libs provide this feature.
Because this is an extension, there is a flag and a command line switch to enable it.
MD_FLAG_HEADINGAUTOID and corresponding --fheading-auto-id are added
This PR is a work in progress and the tasks remaining are:
-
[x] identifier generation in HTML
-
[x] identifier transformation like github
- [x] space changed to
- - [x] uppercase to lower case
- [x] Unicode upper case to lower case
ΑΓΩ->αγω - [x] identical heading have ending number starting with
-1 - [x] links and footnote are skipped
- [x] Emojis are treated as ponctuation, Unicode emoji are stripped
- [x] space changed to
-
[ ] identifier transformation like Pandoc
- [ ] space changed to
- - [ ] leave
_and., but do not add additional-for surrounding space - [ ] uppercase to lower case
- [ ] Unicode upper case to lower case
ΑΓΩ->αγω - [ ] leading chapter numbers are skipped
- [ ] identical heading have ending number starting with
-1 - [ ] links and footnote are skipped
- [ ] empty identifier are replaced by
section
- [ ] space changed to
-
[x] add a Table of Content
- [x] store heading title and level
- [ ] numbering (eg: 1.2.3)
- [x] tag for TOC placement in document
- [x]
[[_TOC_]]like RedCarpet Markdown - [x] {:toc} like Kramdown Markdown
- [x] [toc] like Typora Markdown
- [x]
Add TOC option to the parser parameter struct for md_parse() and md_html()
- Increase the abi_version to 1
- add --table-of-content[=MARK] and --toc[=MARK] option to md2html
- add --toc-depth=x to limit TOC levels
Codecov Report
Merging #175 (a41ab75) into master (e9ff661) will increase coverage by
0.04%. The diff coverage is92.70%.
@@ Coverage Diff @@
## master #175 +/- ##
==========================================
+ Coverage 94.32% 94.36% +0.04%
==========================================
Files 3 3
Lines 3100 3496 +396
==========================================
+ Hits 2924 3299 +375
- Misses 176 197 +21
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/md4c.c | 94.27% <92.53%> (+0.04%) |
:arrow_up: |
| src/md4c-html.c | 95.36% <100.00%> (+0.16%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.