plugin HTML+Markdown Live Preview

Plugins for SynWrite and CudaText...
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

plugin HTML+Markdown Live Preview

Post by Alexey »

Plugin for CudaText.
Allows to use live preview of HTML and Markdown files in the browser, during editing, without need to reload browser page.
Requires Python 3, Flask framework and Markdown2 library.
Tested on Windows 10 and Linux (Ubuntu 19).

How to use
----------

- Install Python 3 from official site. With adding it to PATH variable.
- Install Flask in Python.
Run in terminal:
pip install flask
pip install markdown2
on Unix:
pip3 install flask
pip3 install markdown2

- In CudaText, specify path to browser: "Plugins / HTML Live Preview / Config".
For example: "chrome", "firefox", "opera" or full path to executable file.
Restart CudaText.

- In CudaText, call "Plugins / HTML Live Preview / Start server".
This should show terminal with running Flask server.
Browser should open at http://127.0.0.1:5000/view

After that, just edit some HTML file.
Server will detect your changes (after last editing, make small pause)
and browser should show the preview.

Lexer names handled: any with "HTML", "Jinja2" and "Markdown".

Note: on clicking any link in the browser, live preview stops, until you return to the
http://127.0.0.1:5000/view


Browsers
--------

Supported:
- Google Chrome
- Firefox
- Opera
- Microsoft Edge 42

Not supported:
- Internet Explorer


About
-----
Authors:
Medvosa, https://github.com/medvosa
Alexey Torgashin (CudaText)
User avatar
kvichans
Posts: 203
Joined: 07.10.2012 05:45

Post by kvichans »

Cool!
CudaText 1.163, TC9.51x32, Win10x64(1920x1080)
miro.matas
Posts: 67
Joined: 26.08.2013 06:16

Post by miro.matas »

really good! very good and usefull…

two questions
  • what's about integrate that preview window directly inside CudaText? I am not sure if it is technically possible… if not, we must to respect current limitations, sure…
  • will be possible to extend current Markdown Preview to that direction?
BTW - where is the right location for CSS on that server? (yes, it is question for someone elese… but maybe some smart people here know the answer… TIA)
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Integrate into Cud - not possible, we need some kind of Chromium for this, and code which works with Chromium.
Make Markdown Preview in similar way - possible, if you give a donation, e.g. 20-30$. (Write in email about it, pls)

CSS location can be in dir of editor's file or sub-dir.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Plugin was reworked.
Now it supports Windows+Unixes (tested only on Ubuntu 19).
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Plugin updated. It now supports Markdown preview too (requires "pip3 install markdown2").
lincpa
Posts: 4
Joined: 13.10.2020 12:31

Post by lincpa »

If Live preview in the sidebar, it is not only more convenient, but also more in line with the idiom of most editors.
just like:

geany plugin:
https://plugins.geany.org/markdown.html ( WebKit )

notepad++ plugin:
https://github.com/NotMad-Text-Editor-P ... rkdownText (Miniblink: a open source, one file, small browser widget base on chromium.)
https://github.com/nea/MarkdownViewerPlusPlus (.net)
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

We have no method to embed chromium (or other library) to Cud's panel (side or bottom). So it is the separate window.
lincpa
Posts: 4
Joined: 13.10.2020 12:31

Post by lincpa »

a open source Preview HTML plug-in for Notepad++ write by Delphi, https://fossil.2of4.net/npp_preview/home

It can customize commands to convert any data to html and preview it. RJ TextED 14.90 Beta support this feature.

Preview Screenshot of "Markdown Literate Programming" and "Clojure Hiccup (HTML DSL)": https://github.com/linpengcheng/ClojureBoxNpp
uvviewsoft
Posts: 392
Joined: 01.12.2020 13:46

Post by uvviewsoft »

this is not useful for CudaText. it is based on MSIE and not Chrome.
Post Reply