Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
logonoff committed Jul 8, 2024
1 parent 4ee2454 commit 1b5ec7a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ const DEFAULT_SETTINGS: InlineSpoilerPluginSettings = {
const SPOILER_REGEX = /\|\|(.+?)\|\|/g;

const updateReadingMode = (element: HTMLElement, plugin: InlineSpoilerPlugin) => {
const paragraphs = element.findAll("p");
const allowedElems = element.findAll("p, li, h1, h2, h3, h4, h5, h6, blockquote, em, strong, b, i, a, th, td");

for (const paragraph of paragraphs) {
let newHTML = paragraph.innerHTML;
for (const elem of allowedElems) {
let newHTML = elem.innerHTML;

// find all substrings that start and end with the string "||"
const matches = paragraph.innerText.match(SPOILER_REGEX);
const matches = elem.innerText.match(SPOILER_REGEX);

if (matches) {
for (const match of matches) {
const spoilerSpan = createSpan({ cls: "inline_spoilers-spoiler", text: match.slice(2, -2) });
newHTML = newHTML.replace(match, spoilerSpan.outerHTML);
}

paragraph.innerHTML = newHTML;
elem.innerHTML = newHTML;
}
}

Expand Down
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "inline-spoilers",
"name": "Inline spoilers",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "Implements Discord-like syntax for inline spoilers in Obsidian notes reader mode.",
"version": "1.0.1",
"minAppVersion": "1.6.5",
"description": "Adds Discord-like syntax for inline spoilers in reader mode.",
"author": "logonoff",
"authorUrl": "https://logonoff.co",
"isDesktopOnly": false
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "obsidian-inline-spoilers",
"version": "1.0.0",
"description": "Implements Discord-like syntax for inline spoilers in Obsidian notes.",
"version": "1.0.1",
"description": "Adds Discord-like syntax for inline spoilers in reader mode.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"1.0.1": "1.6.5",
"1.0.0": "1.6.5"
}

0 comments on commit 1b5ec7a

Please sign in to comment.