From 399117088b2cc186b2463a5078622c613fcfbccb Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Fri, 24 Mar 2023 01:21:08 -0700 Subject: [PATCH] docs: add custom anchor example (#2130) --- docs/guide/markdown.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/guide/markdown.md b/docs/guide/markdown.md index 0d87062c..392f4008 100644 --- a/docs/guide/markdown.md +++ b/docs/guide/markdown.md @@ -6,6 +6,16 @@ VitePress comes with built in Markdown Extensions. Headers automatically get anchor links applied. Rendering of anchors can be configured using the `markdown.anchor` option. +### Custom anchors + +To specify a custom anchor tag for a heading instead of using the auto-generated one, add a suffix to the heading: + +``` +# Using custom anchors {#my-anchor} +``` + +This allows you to link to the heading as `#my-anchor` instead of the default `#using-custom-anchors`. + ## Links Both internal and external links gets special treatments.