0.4.2 • Published 5 months ago
markdown-it-jsr-ref v0.4.2
markdown-it-jsr-ref
This is a markdown-it plugin that turns backtick-enclosed symbols into links to JSR API references. For example, the following Markdown snippet:
The `jsrRef()` function takes `Options` object as its argument.
will be transformed into:
The [`jsrRef()`] function takes [`Options`] object as its argument.
[`jsrRef()`]: https://jsr.io/@hongminhee/markdown-it-jsr-ref@0.1.0/doc/~/jsrRef
[`Options`]: https://jsr.io/@hongminhee/markdown-it-jsr-ref@0.1.0/doc/~/Options
and rendered as:
Usage
Since this plugin needs to download the index data from JSR, it requires an asynchronous initialization. After once a plugin instance is created, you don't need asynchronous operations anymore:
import MarkdownIt from "markdown-it";
import { jsrRef } from "markdown-it-jsr-ref";
const md = new MarkdownIt();
md.use(await jsrRef({
package: "@hongminhee/markdown-it-jsr-ref",
version: "0.1.0", // "stable" or "unstable" is also available
cachePath: ".jsr-cache.json", // Optional, but highly recommended
}))
Syntax
The plugin recognizes backtick-enclosed symbols as JSR references.
- `ClassName`
- `new ClassName`
- `new ClassName()`
- `InterfaceName`
- `TypeAliasName`
- `functionName()`
- `ClassName.accessorName`
- `ClassName.methodName()`
- `Interface.propertyName`
- `Interface.callSignatureName()`
For methods and properties, you can prefix them with a tilde (~
) to hide
the class or interface name after rendering:
- `~ClassName.accessorName`
- `~ClassName.methodName()`
- `~Interface.propertyName`
- `~Interface.callSignatureName()`
0.4.1-dev.22
9 months ago
0.5.0-dev.25
5 months ago
0.4.1
9 months ago
0.4.2
5 months ago
0.4.0-dev.20
9 months ago
0.4.0
9 months ago
0.4.0-dev.19
1 year ago
0.3.0
1 year ago
0.3.0-dev.15
1 year ago
0.3.2
1 year ago
0.3.1
1 year ago
0.2.0
1 year ago
0.1.0
1 year ago
0.1.0-dev.11
1 year ago
0.1.0-dev.9
1 year ago
0.1.0-dev.8
1 year ago