Skip to content

Commit 94283d8

Browse files
Out with ReHype and in with ReMark!
ReHyper operates on the HTML, while ReMark processes the Markdown, giving us an opportunity to clean up links before they are processed and link checked.
1 parent 2d44929 commit 94283d8

File tree

4 files changed

+18
-25
lines changed

4 files changed

+18
-25
lines changed

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export default defineConfig({
183183
}),
184184
],
185185
markdown: {
186+
remarkPlugins: [removeMarkdownExtensions],
186187
rehypePlugins: [
187188
[
188189
rehypeAstroRelativeMarkdownLinks,
@@ -202,7 +203,6 @@ export default defineConfig({
202203
rel: ["noopener", "noreferrer"],
203204
},
204205
],
205-
[removeMarkdownExtensions, {}],
206206
],
207207
},
208208
});

src/content/docs/identitymodel-oidcclient/manual.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ redirect_from:
1010

1111
OpenID Connect is a protocol that allows you to authenticate users
1212
using a browser and involves browser-based interactions. When using this
13-
library you can choose between two modes: [automatic](./automatic.md) and manual.
13+
library you can choose between two modes: [automatic](/identitymodel-oidcclient/automatic.md) and manual.
1414

1515
We recommend using automatic mode when possible, but sometimes you need
1616
to use manual mode when you want to handle browser interactions yourself.

src/content/docs/identityserver/ui/login/mfa.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ redirect_from:
99
- /identityserver/v7/ui/login/mfa/
1010
---
1111

12-
Duende IdentityServer itself doesn't implement multi-factor authentication (MFA). MFA is part of the login process in the user interface which is the [responsibility of the hosting application](../index.md). Microsoft provides some [general guidelines](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/mfa) on how to enable MFA in ASP.NET Core.
12+
Duende IdentityServer itself doesn't implement multi-factor authentication (MFA). MFA is part of the login process in the user interface which is the [responsibility of the hosting application](/identityserver/ui/index.md). Microsoft provides some [general guidelines](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/mfa) on how to enable MFA in ASP.NET Core.
1313

1414
## MFA Hosted In IdentityServer
1515

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
11
import { visit } from "unist-util-visit";
22
import type { Node, Parent } from "unist";
3+
import type { Plugin } from "unified";
34

45
interface Element extends Parent {
5-
type: "element";
6-
tagName: string;
7-
properties: {
8-
[key: string]: unknown;
9-
};
10-
content: Node;
6+
type: "link";
7+
url: string;
118
children: Node[];
129
}
1310

14-
export default function removeMarkdownExtensions(): (tree: Node) => void {
11+
const removeMarkdownExtensions: Plugin = function () {
1512
return (tree: Node) => {
16-
visit(tree, "element", (node: Element) => {
17-
if (
18-
node.tagName === "a" &&
19-
node.properties &&
20-
typeof node.properties.href === "string"
21-
) {
22-
const match = /(?:\/index)?\.(md|mdx)(#.*)?$/;
23-
if (match.test(node.properties.href)) {
24-
let date = new Date().toLocaleTimeString("en-US", { hour12: false });
13+
visit(tree, "link", (node: Element) => {
14+
const match = /(?:\/index)?\.(md|mdx)(#.*)?$/;
15+
if (match.test(node.url)) {
16+
let date = new Date().toLocaleTimeString("en-US", { hour12: false });
2517

26-
console.log(
27-
`\x1b[90m${date}\x1b[0m \x1b[95m[🔥 *.md(x)]\x1b[0m ${node.properties.href}`,
28-
);
18+
console.log(
19+
`\x1b[90m${date}\x1b[0m \x1b[95m[🔥 *.md(x)]\x1b[0m ${node.url}`,
20+
);
2921

30-
node.properties.href = node.properties.href.replace(match, "$2");
31-
}
22+
node.url = node.url.replace(match, "$2");
3223
}
3324
});
3425
};
35-
}
26+
};
27+
28+
export default removeMarkdownExtensions;

0 commit comments

Comments
 (0)