2

I am using org-mode to format readme files. When I commit a README.org file into github.com, I am able to see its formatted preview. But since I make a lot of changes, I have to keep commit to see its final preview.

=> Markdown has some editors where, while you are making change into markdown file you can see its final preview in real-time; example: (https://github.com/MacDownApp/macdown).

Is there any live-preview approach for org-mode as well? Could it be done within emacs?

Only approach I was able to come up is use https://github.com/GeneKao/orgmode-latex-templates to convert it into pdf for preview after each save.

alper
  • 1,238
  • 11
  • 30
  • 1
    For a very good alternative to the github flavored markdown live-preview, there is the [grip-mode](https://melpa.org/#/grip-mode) package. For additional options see the answer [here](https://emacs.stackexchange.com/a/66285/26163). – dalanicolai Jan 18 '22 at 22:14
  • Can I apply grip-mode for org files as well? – alper Jan 19 '22 at 10:48
  • Yes, (as a comment here on SE can not have less than 12 characters, let me additionally mention that) the question in the link is also about org-mode specifically. – dalanicolai Jan 19 '22 at 13:00

1 Answers1

1

You can try exporting README.org as html and view it in a browser.

Simplest is C-c C-e h h (bound to org-html-export-to-html) which produces a basic html file. If you need more than this for testing, you could tweak templates and css as described in the manual, and there are various other packages for changing the output on melpa (e.g. ox-twbs).

For a live preview, there is org-preview-html which should be able to preview the generated html in emacs (but I've not tested it)

zzkt
  • 456
  • 3
  • 10
  • This does not show the images on the html. Is there any way to show them too? – alper Dec 10 '21 at 16:02
  • it should work with images. maybe check the img tags in the generated html to see if there is an issue with the paths? – zzkt Dec 10 '21 at 16:58
  • original path is `[[file:/docs/gui1.png]]` but its formatted as `gui1.ping` in the html file. I can see the image in the github using the same format – alper Dec 11 '21 at 06:41
  • 1
    @alper, try an alternative - export to html5 via pandoc. – Ian Dec 11 '21 at 14:11
  • @Ian Thanks I will look into it. Do you have any advice for the `export to html5 via pandoc.` approach? – alper Dec 11 '21 at 14:50
  • Nothing important; may depend on what you write in such file. – Ian Dec 12 '21 at 12:34
  • I am sorry for a late comment but afterwards can we convert html to pdf? or shoud I directly convert org to pdf? – alper Apr 09 '23 at 13:40