From 77781e07ed5dbff4e1d72437517b553c06e21bed Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 13 Feb 2025 18:46:53 +0100 Subject: [PATCH] Don't parse content in code blocks (#1899) --- lib/rehype-sn.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rehype-sn.js b/lib/rehype-sn.js index fb35bf4b..231c0104 100644 --- a/lib/rehype-sn.js +++ b/lib/rehype-sn.js @@ -16,6 +16,11 @@ export default function rehypeSN (options = {}) { return function transformer (tree) { try { visit(tree, (node, index, parent) => { + if (parent?.tagName === 'code') { + // don't process code blocks + return + } + // Handle inline code property if (node.tagName === 'code') { node.properties.inline = !(parent && parent.tagName === 'pre')