It seems that the Gist embedding functionality only looks for lines where a Gist was linked... without checking if there is _other_ content on the line.
For the following content:
...in lacinia dolor vitae purus euismod euismod. Pellentesque ac turpis nulla. Morbi elementum eros in rutrum dignissim.
Lorem ipsum dolor sit amet, [consectetur adipiscing elit](https://gist.github.com/user/hash). Ut id ipsum euismod, maximus leo a, facilisis tortor. Phasellus et nulla egestas, ornare ipsum nec, congue mi. Suspendisse dolor arcu, lobortis ut dui ut, ultrices accumsan nisl.
Nam sodales ut ante et rutrum. Donec sit amet tortor...
The entire middle paragraph gets replaced with the embedded Gist, hiding the content for anyone that has this plugin installed.
You're right, it's caused by parentNode
here:
The reason was that the embed would be created in a p
instead of inside an a
element, but probably that's not necessary.
PR welcome!
It's expected that only links on their own line are selected:
But the :only-child
selector does not work when the sibling is just text (because it's not really a sibling) so there just needs to be a better way to determine if the link is on its own line. I'll take a look at it.
Test comment
...in lacinia dolor vitae purus euismod euismod. Pellentesque ac turpis nulla. Morbi elementum eros in rutrum dignissim.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut id ipsum euismod, maximus leo a, facilisis tortor. Phasellus et nulla egestas, ornare ipsum nec, congue mi. Suspendisse dolor arcu, lobortis ut dui ut, ultrices accumsan nisl.
Nam sodales ut ante et rutrum. Donec sit amet tortor...
This should still embed:
https://gist.github.com/rotemtam/b4474f732674a9fd5884719d8c5bdf3e
Most helpful comment
It's expected that only links on their own line are selected:
https://github.com/sindresorhus/refined-github/blob/1e2428126e1e4eabe4e822eac6f2efd9263f02cc/source/features/embed-gist-inline.js#L42
But the
:only-child
selector does not work when the sibling is just text (because it's not really a sibling) so there just needs to be a better way to determine if the link is on its own line. I'll take a look at it.