Hello,
There is some strange rendering behavior around shr. When I start reading one of the newer epub ebooks from oreilly using nov.el, in some sentences the whitespace between two words is missing.
For instance:
`#+begin_example`
`Wecan’t stress enough the importance of experimentation as you learn new concepts here and throughout the book.`
`#+end_example`
Here, the whitespace is missing between \`We\` and \`can't\`.
So I did checked the xhtml source of the epub:
`#+begin_src html`
`<p>We<a data-type="indexterm" data-primary="code examples" data-secondary="downloading" id="idm45654236145288"/><a data-type="indexterm" data-primary="online resources" data-secondary="code examples" id="idm45654236144280"/><a data-type="indexterm" data-primary="GitHub, code examples from" id="idm45654236143336"/> can’t stress enough the importance of experimentation as you learn new concepts here and throughout the book.`
`#+end_src`
As you can see, there is an anchor tag between the words, but with whitespace between the words.
So I started \`debug-on-entry\` on the function `libxml-parse-html-region` to see
what happened with the dom.
This is my debug log:
`#+begin_example`
`Debugger entered--entering a function:`
`* undo-auto--undoable-change()`
`* shr-insert(" can’t stress enough the importance of experimenta...")`
`* shrface-tag-p((p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))`
`* shr-descend((p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))`
`* shr-tag-body((body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta...")))`
`* shr-descend((body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta...")))`
`* shr-tag-html((html nil (body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))))`
`* shr-descend((html nil (body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))))`
`* #<subr shr-insert-document>((html nil (body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))))`
`* apply(#<subr shr-insert-document> (html nil (body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))))`
`* shr-insert-document((html nil (body nil (p nil "We" (a ((data-type . "indexterm") (data-primary . "code examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " can’t stress enough the importance of experimenta..."))))`
`shr-render-buffer(#<buffer test.xhtml>)`
`funcall-interactively(shr-render-buffer #<buffer test.xhtml>)`
`call-interactively(shr-render-buffer record nil)`
`command-execute(shr-render-buffer record)`
`execute-extended-command(nil "shr-render-buffer" "shr-re")`
`funcall-interactively(execute-extended-command nil "shr-render-buffer" "shr-re")`
`call-interactively(execute-extended-command nil nil)`
`command-execute(execute-extended-command)`
`#+end_example`
The whitespace is inserted correctly. But after calling
`undo-auto--undoable-change()` the whitespace was removed in the \*html\* buffer.
What is happening here?
Thank you!