gatsby-remark-jh-inline-svg
Advanced tools
Comparing version
@@ -11,3 +11,3 @@ const visit = require('unist-util-visit') | ||
visit(markdownAST, 'image', (node) => { | ||
const { url } = node | ||
const { url, alt, title } = node | ||
@@ -24,5 +24,10 @@ if (url.endsWith('.svg')) { | ||
if (alt) html = html.replace(/<title>.*<\/title>/, `<title>${alt}</title>`); | ||
if (html) { | ||
node.type = 'html' | ||
node.value = `${html}` | ||
node.value = `<figure> | ||
${html.trim()} | ||
${title ? `<figcaption>${title}</figcaption>` : ''} | ||
</figure>` | ||
} | ||
@@ -29,0 +34,0 @@ } |
{ | ||
"name": "gatsby-remark-jh-inline-svg", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Gatsby plugin to inline SVGs in Jonathan Harrell's site", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2296
8.76%29
16%