Review feedback on the first revision:
1. Queued A -> B -> A could lose the final A: the unchanged-write check
ran at request time, before preceding writes settled. The comparison
now happens inside the serialized queue, after all earlier writes
complete, against the cache value at execution time.
2. The suppression cache could block corruption recovery: repairing an
invalid externally synchronized data.json with content equal to the
cache was skipped. persistSnapshot() gained a force path used by the
invalid-data write-back and the startup recovery choice.
3. Canonicalization now preserves native JSON.stringify value semantics:
toJSON results are serialized instead of the source object (Date ->
ISO string), and objects accumulate into a null-prototype map so an
own __proto__ key stays data instead of hitting the prototype setter.
4. Added committed regression tests (npm run test:settings): key-order
equivalence, array order, Date/toJSON, __proto__ safety, unchanged
skip, queued A -> B -> A, failed-write retry, force repair, cache
seeding.
5. Restored the 2.29.1 release-note line about script input suggesters
that the previous revision dropped.
The canonical serializer moved into SerializedSettingsWriter.ts so the
node:test suite can import one module without bundler resolution.
data.json was rewritten in an endless loop when two persistence paths
serialized the same settings with different key orders: the load-time
drift check compared JSON.stringify outputs, which are sensitive to key
order, so every incoming shape was classified as drift and re-persisted,
and each write re-triggered the counterpart. Vaults tracked with Obsidian
Git accumulated hundreds of no-change backup commits per day.
- serialize settings with recursively sorted object keys so the byte
form is a pure function of the settings value
- skip persistence when the canonical form matches the last persisted
payload; seed that cache from the on-disk payload after a clean load
- compare drift canonically in the loadSettings write-back check
When the drawing is the active file and no onImageFilePathHook is set, an
imported image is saved the way Obsidian saves one pasted or dropped into a
markdown note, so attachment-management plugins apply their naming and
location rules to it. A generated paste name follows Obsidian's own
"Pasted image YYYYMMDDHHmmss" in that case. Every other caller keeps the
existing path.
A subpath embeddable can mount before CanvasNodeFactory has finished its
asynchronous initialization on layout ready. The mount check treated an
uninitialized factory the same as an absent subpath and fell through to a
workspace leaf, which renders the whole file - for a hybrid drawing, the
entire drawing - and cannot be edited. Wait for the factory instead, with a
timeout so the leaf fallback still applies when it never initializes.
[#2931](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2931)
Obsidian's Export to PDF renders the document in its own window (often a
popout), but markdownPostProcessor's isPrinting check only ever looked at
mainDocument's body for the .print marker, so it silently stayed false for
these exports. That caused any section containing a real embed (e.g. a
plain image in a hybrid note's markdown side) to hit the "hide non-preview
excalidraw content" branch and render blank, since none of
isPreview/isMarkdownReadingMode/isPrinting were true.
- Detect isPrinting via the print owner document, not always mainDocument.
- Only route a section through tmpObsidianWYSIWYG's frontmatter/area-ref
handling when it has no real embeds of its own; sections with embeds
fall through to processReadingMode, same as the non-print path.
- processInternalEmbed/tmpObsidianWYSIWYG now resolve an internal-embed's
actual link target via getFirstLinkpathDest instead of assuming it's
always the containing Excalidraw file, so embedding a different drawing
in a hybrid note's markdown side renders correctly too.
Fixes#2292
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>