https://github.com/dahlia/markdown-it-jsr-ref
A markdown-it plugin that turns backtick-enclosed symbols into links to JSR API references
https://github.com/dahlia/markdown-it-jsr-ref
jsr markdown markdown-it markdown-it-plugin
Last synced: 5 months ago
JSON representation
A markdown-it plugin that turns backtick-enclosed symbols into links to JSR API references
- Host: GitHub
- URL: https://github.com/dahlia/markdown-it-jsr-ref
- Owner: dahlia
- License: mit
- Created: 2024-04-04T07:05:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-01T03:00:43.000Z (7 months ago)
- Last Synced: 2025-05-07T23:49:03.391Z (5 months ago)
- Topics: jsr, markdown, markdown-it, markdown-it-plugin
- Language: TypeScript
- Homepage: https://jsr.io/@hongminhee/markdown-it-jsr-ref
- Size: 302 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
markdown-it-jsr-ref
===================[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]This is a [markdown-it] plugin that turns backtick-enclosed symbols into links
to [JSR](https://jsr.io/) API references. For example, the following Markdown
snippet:~~~~ markdown
The `jsrRef()` function takes `Options` object as its argument.
~~~~will be transformed into:
~~~~ markdown
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:
> The [`jsrRef()`] function takes [`Options`] object as its argument.
[JSR]: https://jsr.io/@hongminhee/markdown-it-jsr-ref
[JSR badge]: https://jsr.io/badges/@hongminhee/markdown-it-jsr-ref
[npm]: https://www.npmjs.com/package/markdown-it-jsr-ref
[npm badge]: https://img.shields.io/npm/v/markdown-it-jsr-ref?logo=npm
[GitHub Actions]: https://github.com/dahlia/markdown-it-jsr-ref/actions/workflows/main.yaml
[GitHub Actions badge]: https://github.com/dahlia/markdown-it-jsr-ref/actions/workflows/main.yaml/badge.svg
[markdown-it]: https://github.com/markdown-it/markdown-it
[`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/~/OptionsUsage
-----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:~~~~ typescript
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.
~~~~ markdown
- `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:~~~~ markdown
- `~ClassName.accessorName`
- `~ClassName.methodName()`
- `~Interface.propertyName`
- `~Interface.callSignatureName()`
~~~~