Removing the debounced initial load fixes the PDF exports. I also added some css to remove the Recompile button for PDF exports.
While working on this task, I realized that the debouncer/abort function was not functioning correctly for files opened in split views or those containing multiple D2 diagrams. I initially believed that the docId was an identifier generated by the plugin API to recognize individual code blocks within the callback. However, this was not the case. Consequently, I needed to find an alternative location to store the debouncer key. The sole location within the callback where I could store page-related information was ctx.containerEl, which is the entire page container element. By putting an id there, we will now have a debouncer for each separate page view (which is enough).
Test pdf generated with multiple diagrams:
test.pdf
Removing the debounced initial load fixes the PDF exports. I also added some css to remove the Recompile button for PDF exports.
While working on this task, I realized that the debouncer/abort function was not functioning correctly for files opened in split views or those containing multiple D2 diagrams. I initially believed that the docId was an identifier generated by the plugin API to recognize individual code blocks within the callback. However, this was not the case. Consequently, I needed to find an alternative location to store the debouncer key. The sole location within the callback where I could store page-related information was ctx.containerEl, which is the entire page container element. By putting an id there, we will now have a debouncer for each separate page view (which is enough).
Test pdf generated with multiple diagrams: test.pdf