Releases: r4ai/remark-callout
@r4ai/remark-callout@0.6.2
@r4ai/remark-callout@0.6.1
@r4ai/remark-callout@0.6.0
Minor Changes
-
#146
ca1e884
Thanks @r4ai! - Don't render callout body when it is empty. -
#149
93b6571
Thanks @r4ai! - Addoptions.titleInner
to specify the HTML element that wraps the text of the callout title -
#144
fe26ccb
Thanks @r4ai! - Don't render an empty paragraph when the callout body is empty -
#150
156f660
Thanks @r4ai! - Fixed an issue where the body was rendered as the title in callouts with a title consisting only of line breaks
@r4ai/remark-callout@0.5.0
Minor Changes
-
#127
d3aca4c
Thanks @eikowagenknecht! - Format attributes with spaces like Obsidian does it #113 -
#128
2835def
Thanks @r4ai! - Add options to add icon and foldIcon -
#123
f8f2eac
Thanks @eikowagenknecht! - Fix regular expressions accepting invalid syntax #115 -
d40d5b9
Thanks @eikowagenknecht! - Handle titles like obsidian
Patch Changes
@r4ai/remark-callout@0.4.0
Minor Changes
- cd5d841: Fix error when encountering empty blockquote
@r4ai/remark-callout@0.3.4
Patch Changes
- 6580da7: Fix tsconfig to generate ESM output
@r4ai/remark-callout@0.3.3
Patch Changes
- a9ab147: chore: add exports field to package.json
@r4ai/remark-callout@0.3.2
Patch Changes
- 4d3be99: Update README
@r4ai/remark-callout@0.3.0
Minor Changes
-
faede33: [BREAKING] Change default output HTML structure to use the details tag in collapsible callouts
This changes the default option as follows:
export const defaultOptions: Required<Options> = { root: (callout) => ({ - tagName: "div", + tagName: callout.isFoldable ? "details" : "div", properties: { dataCallout: true, dataCalloutType: callout.type, - dataCalloutIsFoldable: String(callout.isFoldable), - dataCalloutDefaultFolded: - callout.defaultFolded == null - ? undefined - : String(callout.defaultFolded), + open: + callout.defaultFolded === undefined ? false : !callout.defaultFolded, }, }), title: () => ({ - tagName: "div", + tagName: callout.isFoldable ? "summary" : "div", properties: { dataCalloutTitle: true, }, }), body: () => ({ tagName: "div", properties: { dataCalloutBody: true, }, }), callouts: null, onUnknownCallout: () => undefined, };
When callout is foldable, it will use the
details
tag for the root and thesummary
tag for the title. ThedetaCalloutIsFoldable
anddataCalloutDefaultFolded
attributes are removed in favor of theopen
attribute.[!important]
Note that the explicit setting of the following options will produce the same HTML-structured output as before:import remarkParse from "remark-parse"; import { unified } from "unified"; import remarkCallout from "@r4ai/remark-callout"; import remarkRehype from "remark-rehype"; import rehypeStringify from "rehype-stringify"; const md = ` > [!note] title here > body here `; const html = unified() .use(remarkParse) .use(remarkCallout, { root: (callout) => ({ tagName: "div", properties: { dataCallout: true, dataCalloutType: callout.type, dataCalloutIsFoldable: String(callout.isFoldable), dataCalloutDefaultFolded: callout.defaultFolded == null ? undefined : String(callout.defaultFolded), }, }), title: () => ({ tagName: "div", properties: { dataCalloutTitle: true, }, }), }) .use(remarkRehype) .use(rehypeStringify) .processSync(md) .toString(); console.log(html);
yields:
<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>
Patch Changes
- 552fae9: make repository mono-repository