kaishin / markoff

A lightweight Markdown (CommonMark) previewer for macOS.
ISC License
793 stars 43 forks source link

Autoscroll to last edited position #9

Open ptzz opened 8 years ago

kaishin commented 8 years ago

This would involve diffing the output HTML and adding some sort of tag with an id, I guess. I wonder how this would affect performance and how bullet proof it's going to be. For instance if the markdown file contains HTML and the last change involves changing an HTML tag then simply inserting another tag will break things. Happy to discuss or even better review a PR.

ptzz commented 8 years ago

Don't know much about HTML rendering but maybe navigate to the closest tag before the first diff in the output HTML? Or even better, if there is some way/api to get an (approximate?) mapping from HTML source line (where first diff is) to vertical position in rendered HTML.

Perhaps some inspiration could be found here.