[Rehype](https://github.com/rehypejs/rehype) plugin to add code title.
npm install rehype-code-titleRehype plugin to add code title.
``shell
npm i rehype-code-title
or
yarn add rehype-code-title
`
markdown:
``md`tsx:pages/_app.tsx`
export default class App extends NextApp {
render() {
const { Component, pageProps } = this.props
return (
)
}
}``
rehype-code-title:
`js
const unified = require("unified")
const remark = require("remark-parse")
const remark2rehype = require("remark-rehype")
const stringify = require("rehype-stringify")
const vfile = require("to-vfile")
const codeTitle = require("rehype-code-title")
function compile(file, opt) {
return unified()
.use(remark)
.use(remark2rehype)
.use(codeTitle, opt)
.use(stringify)
.processSync(vfile.readSync("./example/" + file))
.toString()
}
`
Yields:
`html``
pages/_app.tsx
export default class App extends NextApp {
render() {
const { Component, pageProps } = this.props
return (
<ThemeProvider theme={theme}>
<ColorModeProvider value="light">
<CSSReset />
<Component {...pageProps} />
</ColorModeProvider>
</ThemeProvider>
)
}
}