0.4.2 • Published 8 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/~/Optionsand 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
12 months ago
0.5.0-dev.25
8 months ago
0.4.1
12 months ago
0.4.2
8 months ago
0.4.0-dev.20
12 months ago
0.4.0
12 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
2 years ago
0.1.0
2 years ago
0.1.0-dev.11
2 years ago
0.1.0-dev.9
2 years ago
0.1.0-dev.8
2 years ago