feat: add support for GitHub style admonition syntax
This commit is contained in:
parent
176b38a4cb
commit
8bdad0b2fc
|
@ -11,7 +11,7 @@ import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
|
||||||
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs"
|
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs"
|
||||||
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs"
|
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs"
|
||||||
import remarkDirective from "remark-directive" /* Handle directives */
|
import remarkDirective from "remark-directive" /* Handle directives */
|
||||||
import remarkDirectiveRehype from 'remark-directive-rehype' /* Pass directives to rehype */
|
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
|
||||||
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
|
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
|
||||||
import svelte from "@astrojs/svelte"
|
import svelte from "@astrojs/svelte"
|
||||||
import swup from '@swup/astro';
|
import swup from '@swup/astro';
|
||||||
|
@ -60,7 +60,7 @@ export default defineConfig({
|
||||||
sitemap(),
|
sitemap(),
|
||||||
],
|
],
|
||||||
markdown: {
|
markdown: {
|
||||||
remarkPlugins: [remarkMath, remarkReadingTime, remarkDirective, parseDirectiveNode],
|
remarkPlugins: [remarkMath, remarkReadingTime, remarkGithubAdmonitionsToDirectives, remarkDirective, parseDirectiveNode],
|
||||||
rehypePlugins: [
|
rehypePlugins: [
|
||||||
rehypeKatex,
|
rehypeKatex,
|
||||||
rehypeSlug,
|
rehypeSlug,
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
"@types/markdown-it": "^14.1.1",
|
"@types/markdown-it": "^14.1.1",
|
||||||
"@types/mdast": "^4.0.4",
|
"@types/mdast": "^4.0.4",
|
||||||
"@types/sanitize-html": "^2.11.0",
|
"@types/sanitize-html": "^2.11.0",
|
||||||
|
"remark-github-admonitions-to-directives": "^1.0.5",
|
||||||
"stylus": "^0.63.0"
|
"stylus": "^0.63.0"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|
|
@ -142,6 +142,9 @@ importers:
|
||||||
'@types/sanitize-html':
|
'@types/sanitize-html':
|
||||||
specifier: ^2.11.0
|
specifier: ^2.11.0
|
||||||
version: 2.11.0
|
version: 2.11.0
|
||||||
|
remark-github-admonitions-to-directives:
|
||||||
|
specifier: ^1.0.5
|
||||||
|
version: 1.0.5
|
||||||
stylus:
|
stylus:
|
||||||
specifier: ^0.63.0
|
specifier: ^0.63.0
|
||||||
version: 0.63.0
|
version: 0.63.0
|
||||||
|
@ -3918,6 +3921,9 @@ packages:
|
||||||
remark-gfm@4.0.0:
|
remark-gfm@4.0.0:
|
||||||
resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==}
|
resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==}
|
||||||
|
|
||||||
|
remark-github-admonitions-to-directives@1.0.5:
|
||||||
|
resolution: {integrity: sha512-MSRzDs51HGbUrHJ0es8POuxwJiUycWw4aYCTN2RZhdOm5UvyqdB8ApWoGBj9QAiPSHKw2HWl1hd5rRzWxVfNew==}
|
||||||
|
|
||||||
remark-math@6.0.0:
|
remark-math@6.0.0:
|
||||||
resolution: {integrity: sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==}
|
resolution: {integrity: sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==}
|
||||||
|
|
||||||
|
@ -9235,6 +9241,15 @@ snapshots:
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
remark-github-admonitions-to-directives@1.0.5:
|
||||||
|
dependencies:
|
||||||
|
'@types/mdast': 4.0.4
|
||||||
|
mdast-util-directive: 3.0.0
|
||||||
|
unified: 11.0.5
|
||||||
|
unist-util-visit: 5.0.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
remark-math@6.0.0:
|
remark-math@6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/mdast': 4.0.4
|
'@types/mdast': 4.0.4
|
||||||
|
|
|
@ -64,3 +64,14 @@ This is a note with a custom title.
|
||||||
This is a note with a custom title.
|
This is a note with a custom title.
|
||||||
:::
|
:::
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> [The GitHub syntax](https://github.com/orgs/community/discussions/16925) is also supported.
|
||||||
|
|
||||||
|
```
|
||||||
|
> [!NOTE]
|
||||||
|
> The GitHub syntax is also supported.
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> The GitHub syntax is also supported.
|
||||||
|
```
|
Loading…
Reference in New Issue