0.2.5 • Published 2 years ago

remark-code-title v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

remark-code-title

Remark plugin to add a title to code blocks.

Inspired by:

Demos

AstroNext.js
 Open in StackBlitz  Open in StackBlitz

Installation

npm install remark-code-title

Usage

Given this markdown file example.md:

# Example

```js title="example.js"
console.log("Hello World");
```

And this script, example.js, using remark-code-title:

import codeTitle from "remark-code-title";
import html from "remark-html";
import { read } from "to-vfile";
import { remark } from "remark";

const processor = remark().use(codeTitle).use(html, { sanitize: false });
const markdown = await read("example.md");
const result = await processor.process(markdown);

Running node example.js yields:

<h1>Example</h1>
<div data-remark-code-title data-language="js">example.js</div>
<pre>
  <code>console.log("Hello World");</code>
</pre>
0.2.3

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago