-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from yunu7067/develop
v1.0.11
- Loading branch information
Showing
15 changed files
with
213 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/* Remark Plugins */ | ||
export {default as remarkMath} from 'remark-math'; | ||
export * from './remark-reading-time.mjs'; | ||
export {remarkCodeTitle} from './remark-code-title.mjs'; | ||
|
||
/* Rehype Plugins */ | ||
export {default as rehypeKatex} from 'rehype-katex'; | ||
export * from './rehype-figure.mjs'; | ||
export * from './rehype-autolink-heading.mjs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {s} from 'hastscript'; | ||
import rehypeAutolinkHeadings from 'rehype-autolink-headings'; | ||
|
||
export const rehypeAutolinkHeading = [ | ||
rehypeAutolinkHeadings, | ||
{ | ||
behavior: 'prepend', | ||
content: s( | ||
`svg`, | ||
{width: '0.875em', height: '0.875em', viewBox: `0 0 24 24`}, | ||
s(`path`, {fill: `none`, d: 'M0 0h24v24H0z'}), | ||
s(`path`, {fill: `currentColor`, d: 'M17 11V4h2v17h-2v-8H7v8H5V4h2v7z'}), | ||
), | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {visit} from 'unist-util-visit'; | ||
|
||
/** | ||
* @author https://www.npmjs.com/package/remark-code-titles | ||
*/ | ||
export function remarkCodeTitle() { | ||
return tree => | ||
visit(tree, 'code', (node, index) => { | ||
const nodeLang = node.lang || ''; | ||
let language = '', | ||
title = ''; | ||
|
||
if (nodeLang.includes(':')) { | ||
language = nodeLang.slice(0, nodeLang.search(':')); | ||
title = nodeLang.slice(nodeLang.search(':') + 1, nodeLang.length); | ||
} | ||
|
||
if (!title) { | ||
return; | ||
} | ||
|
||
const className = 'remark-code-title'; | ||
|
||
const titleNode = { | ||
type: 'html', | ||
value: `<div class="${className}">${title}</div>`.trim(), | ||
}; | ||
|
||
tree.children.splice(index, 0, titleNode); | ||
node.lang = language; | ||
}); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.