# markdown-it-link-to-html

> Markdown It plugin

Latest version **0.1.2** (published 2022-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-link-to-html
pnpm add markdown-it-link-to-html
yarn add markdown-it-link-to-html
bun add markdown-it-link-to-html
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-12-20 |
| First published | 2022-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | luoxiaozero |
| Maintainers | luoxiaozero |
| Keywords | markdown-it, markdown-it-plugin, link, html |

## Links

- npm: https://www.npmjs.com/package/markdown-it-link-to-html
- Repository: https://github.com/luoxiaozero/markdown-it-link-to-html
- Issues: https://github.com/luoxiaozero/markdown-it-link-to-html/issues
- npm.io page: https://npm.io/package/markdown-it-link-to-html

## Dependencies (1)

- [markdown-it](https://npm.io/package/markdown-it.md) ^13.0.1

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2022-12-20
- 0.1.1 — 2022-12-20
- 0.1.0 — 2022-12-20
- 0.0.4 — 2022-12-20
- 0.0.3 — 2022-12-19
- 0.0.2 — 2022-12-19
- 0.0.1 — 2022-12-19

## README

# markdown-it-link-to-html

Link conversion to HTML

`[me](https://me.me)`

`<a href="https://me.me">me</a>` into `<RouterLink to="https://me.me">me</RouterLink>`

## Install

```
npm i -D markdown-it-link-to-html
```

## Usage

1. For HTTPS，Change to ReplaceLink

```js
import MarkdownIt from "markdown-it";
import LinkToHtml from "markdown-it-link-to-html";

const md = MarkdownIt();

md.use(LinkToHtml, {
    replaceLink: (href) => {
        if (href.startsWith("https")) {
            /// href is https, return ReplaceLink
            return {
                tag: "ReplaceLink",
            };
        }
        /// href is no https, don't change
        return undefined;
    },
});
```

2. All change to RouterLink

```js
import MarkdownIt from "markdown-it";
import LinkToHtml from "markdown-it-link-to-html";

const md = MarkdownIt();

md.use(LinkToHtml, {
    replaceLink: (href) => {
        return {
            tag: "RouterLink",
            hrefName: "to",
        };
    },
});
```

3. 

```js
import MarkdownIt from "markdown-it";
import LinkToHtml from "markdown-it-link-to-html";

const md = MarkdownIt();

md.use(LinkToHtml, {
    linkify: true, // To deal AutoLink
    replaceLink: (href) => {
        return {
            tag: "RouterLink", // Modify RouterLink to tag,Required.
            hrefName: "to", // Modify href key to to
            href: "/", //  Modify href value to /
            title: "hi", //  Modify title value to hi
            // Add attribute,But the key can't be href or title
            attrs: { 
                class: "p1"
            }
        };
    },
});
```

[MIT](./LICENSE) License

---
_Source: https://npm.io/package/markdown-it-link-to-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
