Praxxian / lava-flow

A Foundry VTT module that allows you to import your notes from Obsidian MD into Foundry journal entries.
MIT License
68 stars 11 forks source link

Markdown Support for Secrets #29

Closed Praxxian closed 7 months ago

Praxxian commented 1 year ago

Foundry HTML journal pages support a "secret" block: <section id="secret-demo" class="secret"><p>Some secret</p></section>

While HTML can be used in Obsidian, this is cumbersome:

  1. User has to manage their own secret id, which controls hidden/revealed status.
  2. User has to write HTML instead of markdown.

Proposed solution: Either

  1. See if showdown js has any native support for translating markdown to a particular class. Pseudocode: showdown.addMapping('[!SECRET]','section','secret')
  2. Implement my own convention, such as a "secret" callout, that I convert into HTML when the content is imported. This would use Foundry's API to assign a new secret ID to each section to determine if it has been revealed.

A potential problem with the last option is that Obsidian won't "know" which secrets have been revealed. So IDs have to be created with some convention like "note-name-0" that will not be disturbed on re-import.

Dijmo commented 1 year ago

Ah I'm glad to see this is listed as an enhancement - just getting into Obsidian and lava flow and wondering if there was a clean way to sync obsidian with foundry without giving all my notes to the players!

TBH I had to look up what you meant by a secret being revealed in foundry, because I didn't even realize a secret could be revealed to players in a journal entry. Feels kinda silly when you could just remove the secret block entirely - as far as I can tell there's no difference between a revealed secret and regular text. Just a thought, but at least in my experience the potential problem with option 2 wouldn't actually be an issue for users who don't reveal secrets period.

Praxxian commented 7 months ago

Been a while but I am closing this. I think since the v11 journal updates, secrets work differently. There's no option to reveal, you just change the formatting. So, the solution would be to just put this in your notes: <section class="secret"><p>This is a secret!</p></section>.