From 6b003e9cc9128741c4fd5c651308930ad0430484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Puls?= Date: Fri, 14 Jul 2023 14:43:50 +0200 Subject: [PATCH] Ignore text inside code blocks Fixes #1 --- main.ts | 5 +++++ manifest.json | 2 +- package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 6d1137f..0b8f7b1 100644 --- a/main.ts +++ b/main.ts @@ -8,6 +8,11 @@ export default class AutoTypographyPlugin extends Plugin { // Go through all text nodes in the rendered HTML while ((currentNode = treeWalker.nextNode())) { + // Skip anything inside code blocks + if (currentNode.parentElement?.closest("code") != null) { + continue; + } + let t = currentNode.textContent!; // convert triple hyphens to em-dash diff --git a/manifest.json b/manifest.json index f240963..689fb45 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-auto-typography", "name": "Auto-Typography", - "version": "1.0.0", + "version": "1.0.1", "minAppVersion": "0.15.0", "description": "Automatically converts ASCII to Unicode typography", "author": "René Puls", diff --git a/package.json b/package.json index 2926923..9ee6b99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-auto-typography", - "version": "1.0.0", + "version": "1.0.1", "description": "Obsidian plugin that converts ASCII to Unicode typography", "homepage": "https://github.com/kianga/obsidian-auto-typography", "bugs": "https://github.com/kianga/obsidian-auto-typography/issues",