-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Describe the bug
VS Code region names in Markdown file inclusion don't support special characters like dots (.) or hyphens (-), even though the documentation shows examples with hyphens. When attempting to include a region with these special characters, nothing is included in the output. Interestingly, if a region name doesn't exist at all, the entire file is included, but if the region exists and contains special characters, nothing is included.
Reproduction
- Create a markdown file with VS Code regions containing special characters in the region name:
Example with hyphens (example-hyphen.md):
<!-- #region api-endpoints -->
## GET /users
Fetches all users.
## POST /users
Creates a new user.
<!-- #endregion api-endpoints -->Example with dots (example-dot.md):
<!-- #region auth.service -->
## Login Method
Authenticates a user.
## Logout Method
Ends user session.
<!-- #endregion auth.service -->- Try to include these regions in another markdown file:
# API Documentation
<!-- Trying to include region with hyphen -->
<!--@include: ./example-hyphen.md#api-endpoints-->
<!-- Trying to include region with dot -->
<!--@include: ./example-dot.md#auth.service-->- Build with VitePress - no content from the regions with special characters will be included
Expected behavior
Regions with special characters like dots and hyphens should be properly included, as suggested by the documentation which shows examples with hyphens (e.g., basic-usage).
For the hyphen example, I expect:
# API Documentation
## GET /users
Fetches all users.
## POST /users
Creates a new user.For the dot example, I expect:
# API Documentation
## Login Method
Authenticates a user.
## Logout Method
Ends user session.The documentation itself uses basic-usage as an example region name with a hyphen, so this functionality should work.
System Info
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz
Memory: 17.34 GB / 31.90 GB
Binaries:
Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (128.0.2739.79)
Internet Explorer: 11.0.22621.3527
npmPackages:
vitepress: ^1.6.3 => 1.6.3
Additional context
No response
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.