Skip to content

Commit

Permalink
Version Packages (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Mar 10, 2024
1 parent 7aa1301 commit a4982a4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 82 deletions.
81 changes: 0 additions & 81 deletions .changeset/strong-news-develop.md

This file was deleted.

82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,87 @@
# @r4ai/remark-callout

## 0.2.0

### Minor Changes

- e7f21b3: ## Breaking Changes

In v0.2.0, option to specify a HTML tag for the Body portion of the Callout is added.

For example, In v0.1.x,

```md
> [!note] title here
> body here
```

would be rendered as follows:

```html
<div data-callout data-callout-type="note" data-callout-is-foldable="false">
<div data-callout-title>title here</div>
<p>body here</p>
</div>
```

however, in v0.2.0, the previous markdown is rendered as follows

```html
<div data-callout data-callout-type="note" data-callout-is-foldable="false">
<div data-callout-title>title here</div>
<div data-callout-body>
<p>body here</p>
</div>
</div>
```

This change is a breaking change because it changes the structure of the rendered HTML. If you have any custom CSS or JavaScript that relies on the structure of the rendered HTML, you will need to update it to account for this change.

Now you can specify a HTML tag and HTML attributes for the Body portion of the Callout by using the `body` option.

Example:

```ts
import remarkParse from "remark-parse";
import { unified } from "unified";
import remarkCallout from "../src/index";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";

const md = `
> [!note] title here
> body here
`;

const html = unified()
.use(remarkParse)
.use(remarkCallout, {
body: {
tagName: "callout-body",
properties: {
className: "callout-body",
},
},
})
.use(remarkRehype)
.use(rehypeStringify)
.processSync(md)
.toString();

console.log(html);
```

yields

```html
<div data-callout data-callout-type="note" data-callout-is-foldable="false">
<div data-callout-title>title here</div>
<callout-body class="callout-body">
<p>body here</p>
</callout-body>
</div>
```

## 0.1.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@r4ai/remark-callout",
"version": "0.1.2",
"version": "0.2.0",
"description": "A remark plugin to add obsidian style callouts to markdown",
"author": "rai",
"keywords": [
Expand Down

0 comments on commit a4982a4

Please sign in to comment.