Adding attributes #608
-
Hey, I can't find out how to get attributes into the mix:
My current try is the following: const htmlDirectives = () => {
const tags = {
image: 'img'
}
return transform
function transform (tree) {
visit(tree, ['textDirective', 'leafDirective', 'containerDirective'], ondirective)
}
function ondirective (node) {
const data = node.data || (node.data = {})
const hast = h(node.name, node.attributes)
data.hName = tags[hast.tagName] || hast.tagName
data.hProperties = hast.properties
}
}
<Remark
remarkPlugins={[
[gfm],
[directive],
[htmlDirectives],
]} EditedReading the commonmark specs discussion I assumed I could do However, it seems that the url (anything within the "()" ) is not transferred to the function. Solution |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
To be clear, arobase-che said that PRs are welcome, just that he’s busy with other things (arobase-che/remark-attr#22 (comment)). This is open source after all, and it’s made by all of us. Your error seems to be missing a message. It looks like you omitted the first (few) lines? Making a runnable example, such as a codesandbox, also helps for maintainers to answer questions faster! |
Beta Was this translation helpful? Give feedback.
-
Hey, I found the issue. I thought it would use a link in Concerning the other repo, I did not mean to suggest that it is not okay that he doesn't have time for it. I work on some open source projects myself and know that it is very demanding. I just think that if this is such a huge change, as suggested in the comments, the likelihood of somebody sending a PR is rather slim. I am sorry if that was badly phrased. |
Beta Was this translation helpful? Give feedback.
Hey, I found the issue. I thought it would use a link in
()
as mentioned in one of the referenced documents for pandoc. Got it working now.Concerning the other repo, I did not mean to suggest that it is not okay that he doesn't have time for it. I work on some open source projects myself and know that it is very demanding. I just think that if this is such a huge change, as suggested in the comments, the likelihood of somebody sending a PR is rather slim.
I am sorry if that was badly phrased.