I saw that there's a markdown-live-preview-mode
and the var
markdown-live-preview-window-function
which was set to the function
markdown-live-preview-window-eww
. That function looks like this:
(defun markdown-live-preview-window-eww (file)
"Preview FILE with eww.
To be used with `markdown-live-preview-window-function'."
(eww-open-file file)
(get-buffer "*eww*"))
I hacked around to get something working with xwidget-webkit
:
(defun +markdown-live-preview-window-xwidget-webkit (file)
"Preview FILE with xwidget-webkit.
To be used with `markdown-live-preview-window-function'."
(let ((uri (format "file://%s" file)))
(xwidget-webkit-browse-url uri)
xwidget-webkit-last-session-buffer))
Then I set a quick popup rule:
(set-popup-rule! "^\\*xwidget" :side 'right :size .50 :ttl 0 :quit nil)
And enabled the new hacky function:
(setq markdown-live-preview-window-function
'markdown-live-preview-window-xwidget-webkit)
Now I get live preview in xwidget-webkit
. This is just a quick hack to see if
it's doable. I haven't tested it for more than five minutes, and only with one
markdown file open.
Still, it's nicer than eww
. 😄
Is there a better way to do this? I saw grip-mode but that seems to use an online service.
Screenshot: