Skip to content

Commit

Permalink
fix: fix issue where nested arrays were sometimes being interpreted a…
Browse files Browse the repository at this point in the history
…s wikilinks
  • Loading branch information
valentine195 committed Sep 18, 2023
1 parent 7fad139 commit 844e6a6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/view/statblock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { App, ButtonComponent, Modal, TFile } from "obsidian";
import {
App,
ButtonComponent,
Modal,
TFile,
parseYaml,
stringifyYaml
} from "obsidian";
import { Layout5e } from "src/layouts/basic 5e/basic5e";
import { MarkdownRenderChild } from "obsidian";
import type { Monster, StatblockParameters, Trait } from "../../index";
Expand Down Expand Up @@ -391,8 +398,8 @@ export default class StatBlockRenderer extends MarkdownRenderChild {
});
}
transformLinks(monster: Partial<Monster>): Partial<Monster> {
const built = JSON.parse(
JSON.stringify(monster)
const built = parseYaml(
stringifyYaml(monster)
.replace(/\\#/g, "#")
.replace(
/\[\["(.+?)"\]\]/g,
Expand Down

0 comments on commit 844e6a6

Please sign in to comment.