adds more power linking capability to vite-plugin-md
vite-plugin-md
This repo is hosted externally but provided as a "built-in" part of the vite-plugin-md plugin.
Provides a power-user features for the links in your vite-plugin-md
documents.
// vite.config.js
import Markdown from 'vite-plugin-md'
import { link } from '@yankeeinlondon/link-builder'
export default defineConfig({
// ...
plugins: [
Markdown({ builders: [link()] }),
],
})
With no configuration passed into link()
you will get the following behavior:
http
(versus https:
) resource will be given the class "insecure"mailto:
, file:
, etc.)href
directly to an image, document, code the content type will be be given a class<a href="xyz">
link to a <router-link to="xyz" >
and the relative paths needed to produce a valid route will be calculated for you.md
extension)index.md
fully just leaving the "directory" or "route".md
from all other linksThe configuration is all done with a single dictionary configuration object passed into link( config )
and is fully typed (LinkOptions
). Rather than documenting this twice, just refer to the typed documentation in the config object.