markdown-mode
markdown-mode copied to clipboard
live-preview position & widget webkit
Live preview always scrolls back to top on reload.
Expected Behavior
Updating the end of a markdown file in live-preview-mode should keep the live preview at the bottom as well.
Actual Behavior
the live preview reloads at the top of the document
Steps to Reproduce
I use the following function to generate live previews in emacs of markdown files:
(defun cpm--markdown-live-preview-window-xwidget (file)
"Preview file with xwidget browser"
(xwidget-webkit-browse-url (concat "file://" file))
(let ((buf (xwidget-buffer (xwidget-webkit-current-session))))
(when (buffer-live-p buf)
(and (eq buf (current-buffer)) (quit-window))
(pop-to-buffer buf))))
(setq markdown-live-preview-window-function 'cpm--markdown-live-preview-window-xwidget)
Running live preview with this gives the above described scrolling behavior
Backtrace
no backtrace since there is no actual error.
Software Versions
markdown 2.5-dev emacs 28.0.5 (macOS Catalina 10.15.7 built using homebrew and emac-plus)
We're currently looking into this in a PR in markdown-xwidget
here: https://github.com/cfclrk/markdown-xwidget/pull/8
tl;dr: So far, we're solving this problem with javascript in the browser. If anyone has ideas about how this could be addressed from elisp, that would be super cool.