Skip to content

Commit

Permalink
fix auto-figure
Browse files Browse the repository at this point in the history
  • Loading branch information
dbushell committed Oct 23, 2024
1 parent 77675fa commit a36e9ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const imageNode = (img: Node) => {
img.attributes.set("decoding", "async");
img.attributes.set("fetchpriority", "low");
img.attributes.set("loading", "lazy");
if (img.parent?.tag !== "figure") {
const figure = img.closest((n) => n.tag === "figure");
if (figure === null) {
const figure = new Node(null, "ELEMENT", "", "figure");
figure.attributes.set("class", "Image");
img.replace(figure);
Expand Down

0 comments on commit a36e9ef

Please sign in to comment.