r4ai / remark-callout

A remark plugin to add obsidian style callouts to markdown
https://r4ai.github.io/remark-callout/
MIT License
4 stars 1 forks source link

feat: add `options.titleInner` to specify the HTML element that wraps the text of the callout title #149

Closed r4ai closed 1 month ago

r4ai commented 1 month ago

close #133

Add options.titleInner to specify the HTML element that wraps the text of the callout title.

This option is set by default as follows:

{
  titleInner: (callout, options) =>
    options.icon(callout) == null && options.foldIcon(callout) == null
      ? undefined
      : {
          tagName: "div",
          properties: {
            dataCalloutTitleInner: true,
          },
        },
  // other default options...
}

Following is an example output of callout with icon:

<div data-callout data-callout-type="warn">
    <div data-callout-title>
        <div data-callout-icon><svg class="lucide-circle-alert" xmlns="http://www.w3.org/2000/svg" width="24"
                height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
                stroke-linecap="round" stroke-linejoin="round">
                <circle cx="12" cy="12" r="10"></circle>
                <line x1="12" x2="12" y1="8" y2="12"></line>
                <line x1="12" x2="12.01" y1="16" y2="16"></line>
            </svg></div>
        <div data-callout-title-inner>title here</div>
    </div>
    <div data-callout-body>
        <p>body here</p>
    </div>
</div>
changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 63a70217b73959d1e9138c594c9b414e2ed99d59

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------- | ----- | | @r4ai/remark-callout | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Files Coverage Δ
packages/remark-callout/src/plugin.ts 98.14% <100.00%> (+0.14%) :arrow_up: