MalignantCarp / obsidian-typography-plugin

Obsidian plugin for rendering typographic constructs such as supposed "smart" quotes, en-dashes, em-dashes, ellipses, and the like.
MIT License
5 stars 0 forks source link

Transclusions/embeds are destroyed on Obsidian v0.13.14 (only) #9

Closed MalignantCarp closed 2 years ago

MalignantCarp commented 2 years ago

Not entirely certain how this is a thing, but it appears that embeds/transclusions no longer function in the most recent Obsidian release when this plugin is working.

At present, we pass the HTML element to the typography routine, which runs modifications on the innerHTML of that element. It then returns that innerHTML and we replace that element's innerHTML with the modified innerHTML.

If we immediately return the innerHTML unmodified, it is still a problem, so it is not the modification that is the problem. I am guessing something is going on with the innerHTML now that did not happen in previous versions of Obsidian. If we do not set the innerHTML of the element with the modifications, the transclusion will appear as expected. Not sure if it is sanitization of some kind or what.

The good news is, in newer builds, we now traverse the DOM and make modifications directly to the textContent only of the respective textNodes. However, it is proving difficult to re-establish highlighting while functioning this way. I can push an update immediately that will fix this bug, but will eliminate highlighting.

MalignantCarp commented 2 years ago

And for some reason, the occasional task is duplicated as a regular list item. Not sure how/why that is happening, either. Possibly a bug with Obsidian.

phlind commented 2 years ago

Transclusions of other notes are working for me, but queries don't, they just show the loading animation (in Live Preview mod they do work, just not in Reading mode). I am not sure if you mean the same.

MalignantCarp commented 2 years ago

Interesting. See, this is what I get with the plugin on:

image

And what it is supposed to appear as (with the plugin off and the page reloaded):

image

I am assuming now that if transclusions are working for you, that there must be another plugin that is combining with mine and causing this trouble. I don't suppose you'd mind dropping the list of plugins you have enabled? If I can subtract those from list of 45 that could help me figure out the combination much faster. Although I am rebuilding the plugin to deal only in the DOM without replacing HTML wholesale, in the event I ever do need to handle setting innerHTML, it would be nice for it to work as expected. Something is causing trouble, as when I just get and set the innerHTML rather than doing any of my processing, it all breaks, too.

phlind commented 2 years ago

Reading Mode: Bildschirmfoto 2021-12-27 um 10 30 23

Live Preview: Bildschirmfoto 2021-12-27 um 10 28 05

Here is the list of plugins I have:

better-fn
better-word-count
block-reference-count
cross-reference-navigation
customizable-sidebar
darlal-switcher-plus
dataview
get-info-plugin
graph-analysis
hotkey-helper
longform
map-of-content
metadata-extractor
mrj-add-codemirror-matchbrackets
mysnippets-plugin
note-refactor-obsidian
obsidian-admonition
obsidian-advanced-uri
obsidian-citation-plugin
obsidian-copy-block-link
obsidian-daily-stats
obsidian-hider
obsidian-icon-folder
obsidian-journey-plugin
obsidian-kanban
obsidian-languagetool-plugin
obsidian-native-scrollbars
obsidian-show-file-path
obsidian-stille
obsidian-style-settings
obsidian-tabout
obsidian-timeline
obsidian-typography-plugin
obsidian-vimrc-support
obsidian42-brat
plugin-changelogs
supercharged-links-obsidian
tabout
tag-page-preview
various-complements
MalignantCarp commented 2 years ago

Ah perfect. Your screenshot showed a different Obsidian version. Upgrading to insider build v0.13.16 fixed this, so it was clearly an Obsidian bug in 0.13.14 that has since been fixed.