remark-add-twoslash
v0.0.1
Published
Automatically adds twoslash meta to code blocks in Markdown. 🎸
Downloads
4,259
Readme
Usage
npm i remark-add-twoslashAdd this Remark plugin to wherever you register Markdown/MDX plugins before Expressive Code / Twoslash.
For example, in an Astro Starlight config:
// astro.config.ts
import { defineConfig } from "astro/config";
import { remarkAddTwoslash } from "remark-add-twoslash";
export default defineConfig({
markdown: {
plugins: [remarkAddTwoslash()],
},
});twoslash will be added to any ``` code block whose language starts with ts.
Options
See the exported remarkAddTwoslashOptions type.
excludes
Any number of file paths to exclude from twoslash meta additions.
For example, you might prefer to exclude files in a particular directory, and/or with a certain extension:
import { remarkAddTwoslash } from "remark-add-twoslash";
remarkAddTwoslash({
excludes: [/directory\/to\/ignore/, /\.extension\.mdx$/],
});Development
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! 🎸
Contributors
💝 This package was templated with
create-typescript-appusing the Bingo framework.
