Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request: Allow selection of wrapping element tag #4

Closed
TotallyInformation opened this issue Oct 29, 2024 · 2 comments
Closed

Comments

@TotallyInformation
Copy link

Hi, as GitHub callouts are considered blockquotes, I would much prefer to us a sematic blockhub tag instead of div. Would be possible to add this as a configuration option?

jaywcjlove added a commit that referenced this issue Nov 1, 2024
github-actions bot added a commit that referenced this issue Nov 1, 2024
@jaywcjlove
Copy link
Owner

Wrap tag name with container

let markdown = `> [!CAUTION] \n> Hello World`;
const htmlStr = remark()
  .use(remarkParse)
  .use(remarkAlert, { tagName: "blockquote" })
  .use(remarkRehype)
  .use(rehypeStringify)
  .processSync(markdown).toString()

The output HTML will be:

<blockquote class="markdown-alert markdown-alert-caution" dir="auto">
<p class="markdown-alert-title" dir="auto"><svg class="octicon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>CAUTION</p>
<p>Hello World</p>
</blockquote>

I’m not sure if I misunderstood, but I implemented a tagName setting to change the outer container’s tag name. @TotallyInformation

jaywcjlove added a commit that referenced this issue Nov 1, 2024
github-actions bot added a commit that referenced this issue Nov 1, 2024
@TotallyInformation
Copy link
Author

Cool! Thanks for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants