|
How would I go about setting the Octicon link icon as an inline SVG in <svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="black"
viewBox="0 0 16 16"
>
<path
d="M7.775 3.275a.75.75 0 0 0 1.06 1.06l1.25-1.25a2 2 0 1 1 2.83 2.83l-2.5 2.5a2 2 0 0 1-2.83 0 .75.75 0 0 0-1.06 1.06 3.5 3.5 0 0 0 4.95 0l2.5-2.5a3.5 3.5 0 0 0-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 0 1 0-2.83l2.5-2.5a2 2 0 0 1 2.83 0 .75.75 0 0 0 1.06-1.06 3.5 3.5 0 0 0-4.95 0l-2.5 2.5a3.5 3.5 0 0 0 4.95 4.95l1.25-1.25a.75.75 0 0 0-1.06-1.06l-1.25 1.25a2 2 0 0 1-2.83 0z"
/>
</svg> |
Answered by
wooorm
Jun 2, 2021
Replies: 1 comment 2 replies
|
I would recommend rehypejs/rehype-autolink-headings. It’s closer to what you’re You can create hast nodes with Something like this pseudo code should do the trick: import {s} from 'hastscript'
const content = s(
'svg',
{
xmlns: 'http://www.w3.org/2000/svg',
width: 16,
height: 16,
fill: 'black',
viewBox: '0 0 16 16'
},
s('path', {
d: 'M7.775 3.275a.75.75 0 0 0 1.06 1.06l1.25-1.25a2 2 0 1 1 2.83 2.83l-2.5 2.5a2 2 0 0 1-2.83 0 .75.75 0 0 0-1.06 1.06 3.5 3.5 0 0 0 4.95 0l2.5-2.5a3.5 3.5 0 0 0-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 0 1 0-2.83l2.5-2.5a2 2 0 0 1 2.83 0 .75.75 0 0 0 1.06-1.06 3.5 3.5 0 0 0-4.95 0l-2.5 2.5a3.5 3.5 0 0 0 4.95 4.95l1.25-1.25a.75.75 0 0 0-1.06-1.06l-1.25 1.25a2 2 0 0 1-2.83 0z'
})
)
// ...
unified()
// ...
.use(rehypeAutolinkHeadings, {content})
// ... |
2 replies
Answer selected by
wooorm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would recommend rehypejs/rehype-autolink-headings. It’s closer to what you’re
doing and we’ll deprecate the remark version soonish.
You can create hast nodes with
hastscript. Specifically, in this case,it exposes an SVG builder,
s.Something like this pseudo code should do the trick: