We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad71871 commit c063836Copy full SHA for c063836
docs/gen/html.ts
@@ -4,14 +4,20 @@ import { t } from './texts';
4
import { indent } from './util';
5
6
export function escapeHtml(text = ''): string {
7
- return text
8
- .replaceAll(/&/g, '&')
9
- .replaceAll(/</g, '<')
10
- .replaceAll(/>/g, '>')
11
- .replaceAll(/"/g, '"')
12
- .replaceAll(/'/g, ''')
13
- .replaceAll(/\n/g, '<br>')
14
- .replaceAll(/`([^`]+)`/g, '<code>$1</code>');
+ return (
+ text
+ // change `[text](link)` into `<a href="link">{text}</a>`
+ .replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_match, text, url) => {
+ return `<a href="${url}">${text}</a>`;
+ })
+ .replaceAll(/&/g, '&')
+ .replaceAll(/</g, '<')
15
+ .replaceAll(/>/g, '>')
16
+ .replaceAll(/"/g, '"')
17
+ .replaceAll(/'/g, ''')
18
+ .replaceAll(/\n/g, '<br>')
19
+ .replaceAll(/`([^`]+)`/g, '<code>$1</code>')
20
+ );
21
}
22
23
export function paramULHtml(children: string | string[]): string {
0 commit comments