0.2.11 • Published 11 months ago

@jcayzac/shiki-transformer-autolinks v0.2.11

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@jcayzac/shiki-transformer-autolinks

Shiki transformer that turns URLs into real links.

license npm version npm downloads bundle

Motivation

When you are editing code in an IDE, URLs are often clickable. Whether it's a link to reference documentation in a code comment or a link to an image passed as the src attribute of an HTML <img> element, you may want to visit the link.

Wouldn't it be nice if code rendered by Shiki also had clickable URLs? This is what this transformer enables.

Features

  • Anything that looks like a URL starting with https:// is turned into a clickable link. If the URL ends with punctuation, the punctuation is not part of the generated link.
  • For Markdown markup, the transformer also looks for a title. This means that the link generated for e.g. [Some title](https://example.com) has a title attribute set to Some title.
  • The generated links are keyboard-navigable, and use target="_blank" rel="nofollow noreferrer".
  • They're easy to style: just target code :any-link in your CSS!

Installation

# pnpm
pnpm add @jcayzac/shiki-transformer-autolinks

# bun
bunx add @jcayzac/shiki-transformer-autolinks

# npm
npx add @jcayzac/shiki-transformer-autolinks

# yarn
yarn add @jcayzac/shiki-transformer-autolinks

# deno
deno add npm:@jcayzac/shiki-transformer-autolinks

Like it? Buy me a coffee!

If you like anything here, consider buying me a coffee using one of the following platforms:

GitHub Sponsors Revolut Wise Ko-Fi PayPal


0.2.11

11 months ago

0.2.10

11 months ago

0.2.9

11 months ago

0.2.8

11 months ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.2

11 months ago