Skip to content

Commit c87669f

Browse files
authored
Fix docs links in inline HTML (#42151)
* Fix docs links in inline HTML * ya
1 parent 27483dd commit c87669f

2 files changed

Lines changed: 32 additions & 26 deletions

File tree

site/src/content/docs/getting-started/install.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ You can also do the old fashioned thing and download Bootstrap manually. Choose
130130
<BsTable>
131131
| Type | Description | Link |
132132
| --- | --- | --- |
133-
| <strong class="text-nowrap">Distribution files</strong> | Ready-to-use compiled and minified CSS and JavaScript files. Doesn't include documentation, source files, or dependencies like Floating UI. | {/*<a href="[[config:download.dist]]" class="btn-subtle theme-accent">Download</a>*/} |
134-
| <strong class="text-nowrap">Source files</strong> | Sass, JavaScript, and documentation files for compiling with your own asset pipeline. Requires [Sass compiler]([[docsref:/guides/contribute#sass]]), [Autoprefixer](https://github.com/postcss/autoprefixer), and a JavaScript bundler like [Rollup](https://rollupjs.org/) or [Webpack](https://webpack.js.org/). | {/*<a href="[[config:download.source]]" class="btn-subtle theme-accent">Download</a>*/} |
133+
| <strong class="text-nowrap">Distribution files</strong> | Ready-to-use compiled and minified CSS and JavaScript files. Doesn't include documentation, source files, or dependencies like Floating UI. | <a href="[[config:download.dist]]" class="btn-subtle theme-accent btn-sm">Download</a> |
134+
| <strong class="text-nowrap">Source files</strong> | Sass, JavaScript, and documentation files for compiling with your own asset pipeline. Requires [Sass compiler]([[docsref:/guides/contribute#sass]]), [Autoprefixer](https://github.com/postcss/autoprefixer), and a JavaScript bundler like [Rollup](https://rollupjs.org/) or [Webpack](https://webpack.js.org/). | <a href="[[config:download.source]]" class="btn-subtle theme-accent btn-sm">Download</a> |
135135
</BsTable>
136136

137137
Should you require our full set of [build tools]([[docsref:/guides/contribute#tooling-setup]]), they are included for developing Bootstrap and its docs, but they’re likely unsuitable for your own purposes.

site/src/libs/remark.ts

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,38 @@ export const remarkBsConfig: Plugin<[], Root> = function () {
2626

2727
// https://github.com/syntax-tree/mdast#nodes
2828
// https://github.com/syntax-tree/mdast-util-mdx-jsx#nodes
29-
visit(ast, ['code', 'definition', 'image', 'inlineCode', 'link', 'mdxJsxFlowElement', 'text'], (node) => {
30-
switch (node.type) {
31-
case 'code':
32-
case 'inlineCode':
33-
case 'text': {
34-
node.value = replaceConfigInText(node.value)
35-
break
36-
}
37-
case 'image': {
38-
if (node.alt) {
39-
node.alt = replaceConfigInText(node.alt)
29+
visit(
30+
ast,
31+
['code', 'definition', 'image', 'inlineCode', 'link', 'mdxJsxFlowElement', 'mdxJsxTextElement', 'text'],
32+
(node) => {
33+
switch (node.type) {
34+
case 'code':
35+
case 'inlineCode':
36+
case 'text': {
37+
node.value = replaceConfigInText(node.value)
38+
break
4039
}
40+
case 'image': {
41+
if (node.alt) {
42+
node.alt = replaceConfigInText(node.alt)
43+
}
4144

42-
node.url = replaceConfigInText(node.url)
43-
break
44-
}
45-
case 'definition':
46-
case 'link': {
47-
node.url = replaceConfigInText(node.url)
48-
break
49-
}
50-
case 'mdxJsxFlowElement': {
51-
node.attributes = replaceConfigInAttributes(node.attributes)
52-
break
45+
node.url = replaceConfigInText(node.url)
46+
break
47+
}
48+
case 'definition':
49+
case 'link': {
50+
node.url = replaceConfigInText(node.url)
51+
break
52+
}
53+
case 'mdxJsxFlowElement':
54+
case 'mdxJsxTextElement': {
55+
node.attributes = replaceConfigInAttributes(node.attributes)
56+
break
57+
}
5358
}
5459
}
55-
})
60+
)
5661
}
5762
}
5863

@@ -70,13 +75,14 @@ export const remarkBsDocsref: Plugin<[], Root> = function () {
7075

7176
// https://github.com/syntax-tree/mdast#nodes
7277
// https://github.com/syntax-tree/mdast-util-mdx-jsx#nodes
73-
visit(ast, ['definition', 'link', 'mdxJsxTextElement'], (node) => {
78+
visit(ast, ['definition', 'link', 'mdxJsxFlowElement', 'mdxJsxTextElement'], (node) => {
7479
switch (node.type) {
7580
case 'definition':
7681
case 'link': {
7782
node.url = replaceDocsrefInText(node.url)
7883
break
7984
}
85+
case 'mdxJsxFlowElement':
8086
case 'mdxJsxTextElement': {
8187
node.attributes = replaceDocsrefInAttributes(node.attributes)
8288
break

0 commit comments

Comments
 (0)