glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.8k stars 147 forks source link

Can I make firenvim work with stackedit.io? #1290

Closed evadeflow closed 2 years ago

evadeflow commented 2 years ago

Ermagherd, this is so awesome!! I'm floored that I'm typing in my browser right now and my colorscheme, plugins, keymaps, etc are all working. 🤯 (It took me awhile to figure out how to conditionally tweak my config based on the value of vim.g.started_by_firenvim, but now it's working perfectly.)

If I could make firenvim work with stackedit.io... well, somebody might have to stop me because it's just too much power—bwah-ha-ha-ha-ha-ah!!! Unfortunately, the site uses some kind if 'whizzy' editor thingy, so firenvim doesn't work out-of-the-box.

Does anybody know how/whether I can coax firenvim to embed in the left-hand editing pane of a stackedit.io doc?

glacambre commented 2 years ago

The following config should do what you need:

let g:firenvim_config = {
\ 'localSettings': {
  \ 'stackedit.io': {
    \ 'selector': '.editor__inner.markdown-highlighting',
    \ 'content': 'html'
    \}
  \}
\}

The selector attribute tells firenvim what element it should pay attention to and the content attribute tells firenvim that it should treat the element as HTML rather than text. You will then need to use external tools (for example pandoc) to turn the HTML into the format you want for editing and then back into HTML on BufRead/BufWrite (see :help BufRead and :help BufWrite for more information).

I'll close this issue but feel free to ask any other question you may have :)

evadeflow commented 2 years ago

Thanks! I'll give this a try as soon as I can, and post here if I run into problems.