add: アラート記法に対応

This commit is contained in:
moris 2025-01-31 15:38:24 +09:00
parent 575b2d476c
commit 180f87c416
4 changed files with 50 additions and 0 deletions

View file

@ -194,4 +194,51 @@
margin: 1rem;
font-size: 1.5rem;
}
& .markdown-alert {
padding: 8px 16px;
margin: 1em 0;
& .markdown-alert-title {
display: flex;
align-items: center;
& svg {
fill: currentColor;
margin-right: 8px;
}
}
& p {
margin: 0;
}
&.markdown-alert-note {
border-left: solid #0969da 4px;
& .markdown-alert-title {
color: #0969da;
}
}
&.markdown-alert-tip {
border-left: solid #1a7f37 4px;
& .markdown-alert-title {
color: #1a7f37;
}
}
&.markdown-alert-important {
border-left: solid #8250df 4px;
& .markdown-alert-title {
color: #8250df;
}
}
&.markdown-alert-warning {
border-left: solid #9a6700 4px;
& .markdown-alert-title {
color: #9a6700;
}
}
&.markdown-alert-caution {
border-left: solid #cf222e 4px;
& .markdown-alert-title {
color: #cf222e;
}
}
}
}

View file

@ -9,6 +9,7 @@ import rehypeslug from 'rehype-slug'
import rehypeKatex from 'rehype-katex'
import rehypeHighlight from 'rehype-highlight'
import rehypeExternalLinks from 'rehype-external-links'
import rehypeGithubAlert from 'rehype-github-alert'
import rehypeStringify from 'rehype-stringify'
@ -22,6 +23,7 @@ function Perser(mdtext: string): string {
.use(rehypeKatex, {output:'mathml'}) // 数式
.use(rehypeHighlight) // Syntax highlight
.use(rehypeExternalLinks, {target:'_blank', rel:['noreferrer','noopener']}) // 外部サイトを新規タブで開く
.use(rehypeGithubAlert)
.use(rehypeStringify, {allowDangerousHtml: true})
.processSync(mdtext)
.toString()