remark-source-code
v0.0.3
Published
Import code from local files or remote URLs into your markdown
Maintainers
Readme
remark-source-code
A remark plugin to import code from local files or remote URLs into your markdown.
Installation
npm install remark-source-codeUsage
import {remark} from 'remark';
import remarkSourceCode from 'remark-source-code';
const file = await remark().use(remarkSourceCode, {baseDir: './src'}).process(`
\`\`\`js src="example.js"
\`\`\`
\`\`\`js src="https://example.com/remote.js"
\`\`\`
`);API
remarkSourceCode(options?)
options
Type: object
baseDir
Type: string
Default: process.cwd()
Base directory for resolving local file paths.
Examples
Local Files
\`\`\`js src="path/to/file.js"
\`\`\`Remote URLs
\`\`\`js src="https://example.com/code.js"
\`\`\`With Language and Other Meta
\`\`\`js src="example.js" title="Example Code"
\`\`\`Sponsors
Thanks goes to these wonderful people
License
MIT © anubra266
