foundryvtt-shadowdark icon indicating copy to clipboard operation
foundryvtt-shadowdark copied to clipboard

Added names to Random Name tables gets formatted with <p>name</p>

Open dumplingshop opened this issue 1 month ago • 11 comments

When I added names to the Random Name table, the name that is displayed using the character generator is formatted as <p>Name</p>. Existing names in the compendium don't have this issue, but even editing the existing entries will format those names with the paragraph tags.

dumplingshop avatar Nov 20 '25 04:11 dumplingshop

What version of Foundry and the system are you running?

PrototypeESBU avatar Nov 20 '25 14:11 PrototypeESBU

Foundry Version 13 Build 350, Shadowdark 3.6.0

dumplingshop avatar Nov 20 '25 15:11 dumplingshop

The issue is that foundry defaults to use Paragraph block text and I haven't been able to turn that off. Even if you update the text in the HTML editor view and remove the <p> tags, it re-adds them.

Brittonlj avatar Nov 23 '25 14:11 Brittonlj

We could update the character creation form to look for those <p> tags and remove them.

Brittonlj avatar Nov 23 '25 14:11 Brittonlj

@dumplingshop does the issue only appear in the character generator?

Brittonlj avatar Nov 23 '25 15:11 Brittonlj

@dumplingshop does the issue only appear in the character generator?

That's the only place I've seen the issue. Table results in chat appear as normal.

dumplingshop avatar Nov 23 '25 16:11 dumplingshop

@dumplingshop does the issue only appear in the character generator?

It's weird because the default compendium name values don't generate the paragraph tags, only when adding a name to the table.

dumplingshop avatar Nov 23 '25 16:11 dumplingshop

The issue is related to the changes to roll tables in v13. Rolltable entries now have a name and a description field. In Foundry v13, the description field is HTML so it adds the <p></p> tags to all new entries created. Since the compendium stored tables were created prior to v13, they don't have the <p></p> tags in their description but all new tables will.

The best solution would be to change the field the name generator is looking at from description to name, and then remake the stored system name tables.

PrototypeESBU avatar Nov 23 '25 20:11 PrototypeESBU

The current code looks at the text property. Should that be changed to name?

Brittonlj avatar Nov 25 '25 15:11 Brittonlj

Ah, name is blank. I see what you are saying. In the meantime, I've added a regex to strip all html on that field.

Brittonlj avatar Nov 25 '25 15:11 Brittonlj

Refactored it to look at the name field of the rollable table item.

Brittonlj avatar Nov 25 '25 16:11 Brittonlj