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.

3
  • 1
    For a very good alternative to the github flavored markdown live-preview, there is the grip-mode package. For additional options see the answer here. Jan 18, 2022 at 22:14
  • Can I apply grip-mode for org files as well?
    – alper
    Jan 19, 2022 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. Jan 19, 2022 at 13:00

1 Answer 1

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)

7
  • This does not show the images on the html. Is there any way to show them too?
    – alper
    Dec 10, 2021 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, 2021 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, 2021 at 6:41
  • 1
    @alper, try an alternative - export to html5 via pandoc.
    – Ian
    Dec 11, 2021 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, 2021 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.