Skip to content

Commit

Permalink
docs: update README and interface for anchors prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
derlin committed Dec 30, 2022
1 parent a05ad85 commit 71f04bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ Options:
Whether to trim heading spaces in generated
links (GitLab style) or not (GitHub style)
(default: true)
--anchor-prefix TEXT Prefix added to all anchors and TOC links
(e.g. 'heading-') (default: '')
--anchors / --no-anchors Whether to generate anchors below headings
(BitBucket Server) (default: true)
--comment-style [HTML|LIQUID] Language to use for generating comments
Expand Down Expand Up @@ -141,8 +143,13 @@ In case you are interested, here are the relevant option differences:
* *GitHub* → do not concat spaces, do not generate anchors
* *dev.to* → generate anchors, comment style = liquid

Note that if you render your Markdown using another processor, the *BitBucket Server* is the way to go.
As the anchors are manually added to the markdown, the TOC will work as long as `<a>` tags with a `name` parameter
More platforms are supported while not having a dedicated profile. For example:

* *hashnode* → concat spaces, do not generate anchors, anchors prefix = `heading-`

Note that if you render your Markdown using another processor, the *generate anchors* option is the way to go
(*BitBucket Server* profile).
Since the anchors are manually added to the markdown, the TOC will work as long as `<a>` tags with a `name` parameter
are supported. If you are working with a platform supporting liquid tags (e.g. forem), use *dev.to* instead.

## TOC placement
Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/ch/derlin/bitdowntoc/BitOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object BitOptions {
"Whether to generate anchors below headings (BitBucket Server)"
)
val anchorsPrefix = BitOption(
"anchors-prefix", "anchor prefix", "",
"anchors-prefix", "anchors prefix", "",
"Prefix added to all anchors and TOC links (e.g. 'heading-')"
)
val commentStyle = BitOption(
Expand Down
3 changes: 3 additions & 0 deletions src/jsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ <h1>Markdown TOC generator</h1>
<li><span class="hl">dev.to</span> → generate anchors, use
<a href="https://developers.forem.com/frontend/liquid-tags">liquid tags</a> for comments
</li>
<li>(<span class="hl">hashnode</span>) → concat spaces, do not generate anchors, anchors prefix
set to <code>heading-</code>
</li>
</ul>
<p class="small">
If your markdown renderer is not on the list, turn on <span class="hl">generate anchors</span>
Expand Down

0 comments on commit 71f04bb

Please sign in to comment.