Next.js is a popular framewrokf of react
rehype-code-titles\n\n
\n\n
\n\n Rehype plugin for parsing code blocks and adding titles to code blocks\n\n## Why?\n\nI moved my blog over to using mdx-bundler which uses xdm under the hood to parse the markdown and MDX files. I was using remark-code-titles prior to this move and unfortunately it no longer worked. I believe this was because of the order plugins were being applied internally for xdm. I'd never really worked with remark or rehype directly before and didn't have a lot of experience with ASTs so this was a fun little project that I initially built directly into my blog before pulling it out at a plugin to ship to other developers.\n\nMany thanks to @mottox2, @mapbox, & @wooorm for their prior work in this ecosystem it was of great help when creating this plugin.\n\n## Installation\n\n> This package is ESM only:\n\n> Node 12+ is needed to use it and it must be imported instead of required.\n\nshell:bash\nnpm install rehype-code-titles\n\nyarn add rehype-code-titles\n\npnpm add rehype-code-titles\n\n\n\n## API\n\nThis package exports no identifiers. The default export is rehypeCodeTitles\n\n### rehype().use(rehypeCodeTitles[, options])\n\nAdd support for stripping out code titles from input.\n\n#### options\n\n##### options.customClassName\n\nSpecify your own custom css class name to apply. Defaults to rehype-code-title.\n\nNote: you will have to write the CSS implementation yourself.\n\nFor example\n\ncss:styles.css\n\n// some global css file\n.rehype-code-title {\nmargin-bottom: -0.6rem;\npadding: 0.5em 1em;\nfont-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console',\n'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono',\n'Liberation Mono', 'Nimbus Mono L', Monaco, 'Courier New', Courier,\nmonospace;\n\nbackground-color: black;\ncolor: white;\nz-index: 0;\nborder-top-left-radius: 0.3em;\nborder- top - right - radius: 0.3em;\n\n}\n\n\n\n
About the Author
Open for work
Hi, I'm Ryan from Adelaide, South Australia.
I'm a web developer and computer science tutor. I also rock climb, play wheelchair basketball and brew beer.


