Skip to content

Commit

Permalink
feat: add support for GitHub style admonition syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
saicaca committed Jun 21, 2024
1 parent 176b38a commit 8bdad0b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs"
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs"
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 svelte from "@astrojs/svelte"
import swup from '@swup/astro';
Expand Down Expand Up @@ -60,7 +60,7 @@ export default defineConfig({
sitemap(),
],
markdown: {
remarkPlugins: [remarkMath, remarkReadingTime, remarkDirective, parseDirectiveNode],
remarkPlugins: [remarkMath, remarkReadingTime, remarkGithubAdmonitionsToDirectives, remarkDirective, parseDirectiveNode],
rehypePlugins: [
rehypeKatex,
rehypeSlug,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@types/markdown-it": "^14.1.1",
"@types/mdast": "^4.0.4",
"@types/sanitize-html": "^2.11.0",
"remark-github-admonitions-to-directives": "^1.0.5",
"stylus": "^0.63.0"
},
"pnpm": {
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/content/posts/markdown-extended.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,15 @@ This is a note with a custom title.
:::note[MY 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.
```

0 comments on commit 8bdad0b

Please sign in to comment.