weichenw / obsidian-hypothesis-plugin

An Obsidian.md plugin that syncs highlights from Hypothesis.
MIT License
235 stars 20 forks source link

Strip whitespace from highlight text #37

Closed phgn0 closed 2 years ago

phgn0 commented 2 years ago

Hypothesis annotation TextQuoteSelectors may include newlines, tabs, or space-indented tabs as artifacts of anchoring annotations inside the HTML document. To mirror the display of quotes inside Hypothesis, this PR strips this whitespace from the rendered quotes.

This should make highlights look nice in more cases, I don't think perfect is possible here. The user can always modify the highlight in the rendered file to make it more comprehensible.

Before example:

Screenshot 2022-02-23 at 11 02 46 AM

After example:

Screenshot 2022-02-23 at 11 01 58 AM
weichenw commented 2 years ago

Merged