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

Better HTML Tag Parsing #3

Closed MalignantCarp closed 2 years ago

MalignantCarp commented 2 years ago

There needs to be a more accurate way to traverse the HTML tags to avoid transforming data within HTML tags. Right now a regex seems to be the fastest way, but it could be a character-by-character parser may be needed to avoid edge cases. This would allow the tag and text indices to be accumulated simultaneously. I had originally examined using the children and childNodes, but this has the downside of not easily being able to determine the length of text to skip for the purpose of determining the location of actual text that needs transforming. This wouldn't be an issue if we were also using a character-by-character parser for determining double quotes, single quotes, etc. Those need to be done over the whole continuous block of text in order to function properly.

MalignantCarp commented 2 years ago

Done in 0.0.6