web/docs: add remark plugin for GitHub-compatible markdown links e1365d7f parent ba673549

This adds a remark plugin that transforms .md links (e.g., [text](other.md)) into clean URLs (e.g., other/) that work in the built Starlight site while keeping the original .md links functional on GitHub. Key design decisions: 1. Uses relative paths instead of absolute paths. This ensures links work regardless of the base path configuration (e.g., --base /starlight/). Absolute paths like /glossary/ would break when deployed at a non-root base path. 2. Accounts for Starlight's trailing slash URL behavior. Pages like guides/divergence.md are served at /guides/divergence/, which browsers treat as a directory. For non-index files, the plugin prepends ../ to counteract this, so a link to ../glossary.md becomes ../../glossary/ (which correctly resolves to /glossary/ from /guides/divergence/). 3. Wrapped in a Starlight plugin (starlight-strip-md-extension.mjs). This is required because Starlight overrides the markdown.remarkPlugins config for content collection .md files. Plugins in the top-level markdown config only run on .mdx files. The Starlight plugin wrapper hooks into Starlight's integration system to ensure the transformation runs on all content collection markdown files.

authored by Steve Klabnik

1
site_name: !ENV [MKDOCS_SITE_NAME, 'Jujutsu docs']
2
site_dir: 'rendered-docs'
3
# Not having this (or viewing the site locally, or from any place other than the
4
# site_url) leads to version switching failing to preserve the current path.
5
site_url: 'https://docs.jj-vcs.dev/'
6
repo_url: https://github.com/jj-vcs/jj
7
repo_name: jj-vcs/jj
8
edit_uri: edit/main/docs/
9
theme:
10
name: 'material'
11
language: 'en'
12
favicon: images/favicon-96x96.png
13
features:
14
# - navigation.top
15
- content.action.edit
16
- content.code.copy
17
- content.tabs.link
18
- navigation.instant
19
20
font:
21
# This has the relevant symbols used in the log.
22
code: Google Sans Code
23
24
icon:
25
repo: fontawesome/brands/github
26
edit: material/pencil
27
28
# Respect the user's default settings and add a toggle for manually choosing
29
# automatic/light/dark palette.
30
# taken from https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#system-preference
31
palette:
32
- media: '(prefers-color-scheme)'
33
toggle:
34
icon: material/brightness-auto
35
name: Switch to system preference
36
- media: '(prefers-color-scheme: light)'
37
scheme: default
38
primary: !ENV [MKDOCS_PRIMARY_COLOR, 'indigo']
39
toggle:
40
icon: material/brightness-7
41
name: Switch to light mode
42
- media: '(prefers-color-scheme: dark)'
43
scheme: slate
44
primary: !ENV [MKDOCS_PRIMARY_COLOR, 'indigo']
45
toggle:
46
icon: material/brightness-4
47
name: Switch to dark mode
48
49
extra:
50
version:
51
provider: mike
52
alias: true
53
54
validation:
55
anchors: warn
56
57
plugins:
58
- group:
59
# If you plan to use the rendered docs from your file system, run:
60
# MKDOCS_OFFLINE=true uv run mkdocs build
61
enabled: !ENV [MKDOCS_OFFLINE, false]
62
plugins:
63
- offline
64
- include-markdown # For the CLI reference
65
- mike:
66
# Should help search engines point to latest docs
67
# instead of (often obsolete) v?.??.? docs.
68
# TODO: Arguably, this could be `prerelease` when building prerelease docs.
69
canonical_version: latest
70
- redirects:
71
redirect_maps:
72
branches.md: bookmarks.md
73
- search
74
- table-reader:
75
data_path: docs
76
select_readers:
77
- read_yaml
78
79
# Not all of these may be necessary, especially since the material
80
# theme substitutes for some of them
81
markdown_extensions:
82
- admonition
83
- codehilite:
84
guess_lang: false
85
- extra
86
# Fixes weird concatenation of list items that happens sometimes when
87
# there is not a paragraph break between them and one of them has
88
# multiple paragraphs.
89
- mdx_breakless_lists
90
# Allows list items with several paragraphs to be indented two spaces instead
91
# of four (like GitHub markdown)
92
- mdx_truly_sane_lists:
93
# No, thanks, we'd like only somewhat sane lists :)
94
# With `truly_sane: true`, together with breakless lists, it often splits
95
# a single list in two.
96
truly_sane: false
97
- pymdownx.details
98
- pymdownx.emoji:
99
emoji_generator: !!python/name:material.extensions.emoji.to_svg
100
emoji_index: !!python/name:material.extensions.emoji.twemoji
101
- pymdownx.snippets
102
- pymdownx.superfences:
103
custom_fences:
104
- name: mermaid
105
class: mermaid
106
format: !!python/name:pymdownx.superfences.fence_code_format
107
- pymdownx.tabbed:
108
alternate_style: true
109
slugify: !!python/object/apply:pymdownx.slugs.slugify
110
kwds:
111
case: lower
112
- toc:
113
permalink: true
114
115
nav: # This lists all the files that become part of the documentation
116
- Home: 'index.md'
117
118
- Getting started:
119
- Installation and setup: 'install-and-setup.md'
120
- Tutorial and bird's eye view: 'tutorial.md'
121
- 'Working with Gerrit': 'gerrit.md'
122
- Working with GitHub: 'github.md'
123
- Working on Windows: 'windows.md'
124
125
- FAQ: 'FAQ.md'
126
127
- CLI reference: 'cli-reference.md'
128
129
- Testimonials: 'testimonials.md'
130
131
- Community-built tools: 'community_tools.md'
132
133
- Concepts:
134
- Working copy: 'working-copy.md'
135
- Bookmarks: 'bookmarks.md'
136
- Conflicts: 'conflicts.md'
137
- Operation log: 'operation-log.md'
138
- Glossary: 'glossary.md'
139
140
- Guides:
141
- CLI options for specifying revisions: 'guides/cli-revision-options.md'
142
- Divergent changes: 'guides/divergence.md'
143
- Multiple remotes: 'guides/multiple-remotes.md'
144
145
- Reference:
146
- Settings: 'config.md'
147
- Fileset language: 'filesets.md'
148
- Revset language: 'revsets.md'
149
- Templating language: 'templates.md'
150
151
- Comparisons:
152
- Git comparison: 'git-comparison.md'
153
- Git command table: 'git-command-table.md'
154
- Git compatibility: 'git-compatibility.md'
155
- Jujutsu for Git experts: 'git-experts.md'
156
- Sapling comparison: 'sapling-comparison.md'
157
- Other related work: 'related-work.md'
158
159
- Technical details:
160
- Core tenets: 'core_tenets.md'
161
- Architecture: 'technical/architecture.md'
162
- Concurrency: 'technical/concurrency.md'
163
- Conflicts: 'technical/conflicts.md'
164
165
- Contributing:
166
- Guidelines and "How to...?": 'contributing.md'
167
- Code of conduct: 'code-of-conduct.md'
168
- Style guide: 'style_guide.md'
169
- Design docs: 'design_docs.md'
170
- Design doc blueprint: 'design_doc_blueprint.md'
171
- Releasing: 'releasing.md'
172
- Temporary voting for governance: 'governance/temporary-voting.md'
173
- Governance: 'governance/GOVERNANCE.md'
174
175
- Design docs:
176
- git-submodules: 'design/git-submodules.md'
177
- git-submodule-storage: 'design/git-submodule-storage.md'
178
- JJ run: 'design/run.md'
179
- Sparse patterns v2: 'design/sparse-v2.md'
180
- Tracking branches: 'design/tracking-branches.md'
181
- Copy tracking and tracing: 'design/copy-tracking.md'
182
- Secure config: 'design/secure-config.md'
183
- Managed config: 'design/managed-config.md'
184
- JJ converge (aka resolve-divergence): 'design/jj-converge-command.md'
185
186
- Development roadmap: 'roadmap.md'
187
- Changelog: 'changelog.md'
188
189
# The following follow .gitignore syntax, relative
190
# to the docs dir.
191
not_in_nav: |
192
/paid_contributors.md
193
194