javalent / fantasy-statblocks

Create Dungeons and Dragons style statblocks for Obsidian.md
MIT License
339 stars 68 forks source link

🐞 "e.replace is not a function" for one statblock #410

Closed silentjames closed 2 months ago

silentjames commented 2 months ago

Check for existing bug reports before submitting.

Expected Behavior

Well, would be great to see it working again :)

Current behaviour

I've got the error for one of my statblocks. Haven't used it for a while, changed nothing there, but now it's not rendered in reading view. In console I see the error. It appears even in the blank sandbox vault.

plugin:obsidian-5e-statblocks:410 Uncaught (in promise) TypeError: e.replace is not a function
    at ps.stringifyLinks (plugin:obsidian-5e-statblocks:410:944)
    at oo.stringifyLinks (plugin:obsidian-5e-statblocks:410:2340)
    at fp (plugin:obsidian-5e-statblocks:448:486)
    at K (plugin:obsidian-5e-statblocks:409:7181)
    at new ho (plugin:obsidian-5e-statblocks:450:349)
    at mp (plugin:obsidian-5e-statblocks:450:423)
    at K (plugin:obsidian-5e-statblocks:409:7380)
    at new uo (plugin:obsidian-5e-statblocks:450:778)
    at Ih (plugin:obsidian-5e-statblocks:452:6248)
    at Dp (plugin:obsidian-5e-statblocks:452:6780)

And it goes to this line of code:

stringifyLinks(e) {
            return e.replace(new RegExp(bs,"g"), (t,n)=>`[[${n}]]`).replace(new RegExp(ys,"g"), (t,n,a)=>`[${a || ""}](${n})`)
        }

The statblock I use: WtA w20 Werewolf en.json The simple note:

here ```statblock columnWidth: 680 column: 1 layout: WtA w20 Werewolf en dice: true name: Stu Powell breed: Homid auspice: Ragabash ```
### Reproduction 1. import the statblock; 2. Reload the app 3. Create a new note with the example text; 4. Go to reading view. ### Which Operating Systems are you using? - [ ] Android - [ ] iPhone/iPad - [ ] Linux - [X] macOS - [ ] Windows ### Obsidian Version Check 1.5.3 and 1.5.12 ### Plugin Version 4.3.3 ### Confirmation - [X] I have disabled all other plugins and the issue still persists. ### Possible solution _No response_