Skip to content

Releases: r4ai/remark-callout

@r4ai/remark-callout@0.6.2

26 Sep 05:30
db85605
Compare
Choose a tag to compare

Patch Changes

  • #193 d47cda0 Thanks @r4ai! - Fix broken bundge link in README

  • #191 bc160f2 Thanks @r4ai! - Add instruction to support nested css with Astro's TailwindCSS integration in README

@r4ai/remark-callout@0.6.1

27 Aug 00:33
00cab4b
Compare
Choose a tag to compare

Patch Changes

  • #157 2fad8ef Thanks @r4ai! - Refactor the type definitions to make it easier to automatically generate the API Reference with Typedoc

@r4ai/remark-callout@0.6.0

01 Aug 11:46
3aa126b
Compare
Choose a tag to compare

Minor Changes

  • #146 ca1e884 Thanks @r4ai! - Don't render callout body when it is empty.

  • #149 93b6571 Thanks @r4ai! - Add options.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

21 Jul 13:52
30ec8c9
Compare
Choose a tag to compare

Minor Changes

Patch Changes

@r4ai/remark-callout@0.4.0

11 Jun 06:56
867f1db
Compare
Choose a tag to compare

Minor Changes

  • cd5d841: Fix error when encountering empty blockquote

@r4ai/remark-callout@0.3.4

23 Apr 10:47
Compare
Choose a tag to compare

Patch Changes

  • 6580da7: Fix tsconfig to generate ESM output

@r4ai/remark-callout@0.3.3

15 Apr 02:16
a47a1f6
Compare
Choose a tag to compare

Patch Changes

  • a9ab147: chore: add exports field to package.json

@r4ai/remark-callout@0.3.2

11 Apr 12:43
4b1729d
Compare
Choose a tag to compare

Patch Changes

@r4ai/remark-callout@0.3.0

05 Apr 15:33
ca618dd
Compare
Choose a tag to compare

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 the summary tag for the title. The detaCalloutIsFoldable and dataCalloutDefaultFolded attributes are removed in favor of the open 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

@r4ai/remark-callout@0.3.1

05 Apr 15:36
803fb93
Compare
Choose a tag to compare

Patch Changes

  • 93e078b: chore(deps): update dependency node to v21.7.2
  • ca618dd: chore(deps): update dependency bun to v1.1.1