News for hackers. Stuff that matters.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by terhechte on Wednesday April 10, 2019 @02:40AM (#19622391)
Came here just to say that. I had a static blog written in org-mode and converted it over to markdown a couple of weeks ago because there's no good way of converting org-mode to html except by running emacs. So for each article, getting a html representation requires firing up emacs. That's insane.

If there were good (and fast!) js, c, python, etc libraries to fully support parsing org-mode to AST and HTML, only then would it be a viable solution for markup.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by s7atic on Wednesday April 10, 2019 @03:35AM (#19622620)
Emacs can run as an elisp interpreter, check out the '--script' switch. This makes it possible to run org-export without starting an emacs session.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by kqr on Wednesday April 10, 2019 @07:30AM (#19623602)
I was just about to say. The GP sounds like they're saying

> there's no good way of converting <markup language> to html except by running <preferred converter>. So for each article, getting a html representation requires firing up <preferred converter>. That's insane.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by terhechte on Wednesday April 10, 2019 @08:15AM (#19623849)
And how do I use that when I want to interactively convert org-mode to html in javascript? Like countless pure-javascript markdown libraries allow me to do? not to mention the security hazards of running emacs with any user input from a website.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by kqr on Wednesday April 10, 2019 @09:58AM (#19624656)
That you don't – much like you don't get Pandoc Markdown in JavaScript, because Pandoc is not written in JS.

But if you are content with a less featured variation of the markup language (but still more featureful than Markdown), you can get that for JavaScript too: https://xiaoxinghu.github.io/orgajs/syntax

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by terhechte on Wednesday April 10, 2019 @08:15AM (#19623848)
And how do I use that when I want to interactively convert org-mode to html in javascript? Like countless pure-javascript markdown libraries allow me to do?

not to mention the security hazards of running emacs with any user input from a website.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by yepguy on Wednesday April 10, 2019 @09:06AM (#19624213)
OK, but you just switched use cases from a "static blog" to interactive web page with untrusted inputs.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by omaranto on Wednesday April 10, 2019 @11:54AM (#19625918)
First, pandoc does a pretty decent job of converting Org Mode to HTML or several other formats.

Second, "firing" up Emacs sounds odd to Org Mode's target audience. :) We already have Emacs open! (I typed this comment in Emacs).

I don't know how hard it is to make a nice looking website in Org Mode, but to make bland websites for academics (like this schmuck's page: https://www.matem.unam.mx/~omar/), I think Org Mode and org-publish are great. And probably it's not harder to make a nice website with org-publish than with anything else: the trick is being willing to learn CSS. :)

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by singingfish on Wednesday April 10, 2019 @07:17AM (#19623547)
Pandoc makes me extremely happy. My consultant wanted a .doc file the other day: `pandoc -f org -t support_brief.org -o support_brief.docx`

Of course the canonical format for pandoc is markdown.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by omaranto on Wednesday April 10, 2019 @11:56AM (#19625940)
To be specific, the canonical format for Pandoc is Pandoc Markdown, which is still my favorite flavor of Markdown (I guess Github-falvored is my second favorite). But Org Mode is even nicer than Pandoc Markdown, so I used Pandoc to convert all my files to Org Mode.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by zeckalpha on Wednesday April 10, 2019 @08:06AM (#19623788)
And Hakyll is a static site generator based on Pandoc, letting you leave your site source in whichever markup you choose.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by rakoo on Wednesday April 10, 2019 @02:52AM (#19622438)
If you're turning markup formatted files into html there is pandoc (https://pandoc.org/) for that
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by zaiste on Thursday April 11, 2019 @07:48AM (#19633304)
Kulfon [1] is a static site generator that compiles Org Mode to HTML without using Emacs. You can just drop `.org` files in a directory and run a one-command tool to make this work. I use it for my website, mostly to write blog posts. It is also possible to mix Markdown and Org Mode files in a single project/directory.

Kulfon is my own project, so take it with a grain of salt. I've decided to focus on Org Mode as I also believe this format doesn't get the recognition it deserves. It doesn't mean Markdown is bad, au contraire, it is almost perfect. In Org Mode, for instance, I still cannot get used to the source code blocks. It is, however, good to have a choice.

The Org Mode support in Kulfon is not perfect yet, but good enough for most situations. It is based on a JavaScript plugin by Xiaoxing Hu called orgajs [2]. You can use it directly in your project.

One of the motivations for building a SSG with Org Mode was Org Brain [3]. I have a plenty of interconnected notes that I would like to publish on my website « as-is ». This would be rather difficult to do using Markdown format.

[1]: https://kulfon.org/ [2]: https://github.com/xiaoxinghu/orgajs [3]: https://github.com/Kungsgeten/org-brain

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by TeMPOraL on Wednesday April 10, 2019 @04:09AM (#19622751)
That's a fair point. My own blog runs a two-step process: I export org-mode posts to HTML with Emacs/Org-Mode exporter, and then rewrite the result in my static generator.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by sondr3 on Wednesday April 10, 2019 @09:07AM (#19624220)
Do you have a public repo for your blog? I couldn't find anything on GitHub.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by TeMPOraL on Wednesday April 10, 2019 @05:26PM (#19628951)
Nah, the generator is so full of garbage code that I keep it as a private repo. The generator handles both new posts (org-exported to HTML) and old posts (Wordpress exports I dumped to org mode).

A partial snippet of the code that handles new posts:

https://gist.github.com/TeMPOraL/c401f12d50d4e1d4f94492e3d0f...

What's happening is that I take the HTML generated by Emacs Org Mode exporter, deserialize it to DOM, select a block corresponding to contents (to cut out superfluous stuff I don't need), and then run a bunch of tree-walkers that massages the DOM until it becomes something I can wrap with my site's scaffolding and dump into a file. It's really ugly, but gets the job done.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by db48x on Wednesday April 10, 2019 @04:25AM (#19622816)
That eight megs of memory is a pretty terrible price.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by melling on Wednesday April 10, 2019 @04:53AM (#19622932)
8MB fits in L3 cache these days.
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by Naac on Wednesday April 10, 2019 @03:05AM (#19622486)
Did pandoc not convert org files to HTML correctly?
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by ekns on Wednesday April 10, 2019 @04:17AM (#19622774)
Pandoc only handles a subset of org-mode markup.

IIRC last time I tried this (long ago) there were a number of gaps in things like org-mode tables.

At the limiting case, the (common or uncommon) elisp extensions (e.g. org-babel) will likely never be processed by third-party tools.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by disgruntledphd2 on Wednesday April 10, 2019 @05:31AM (#19623100)
If you put the results of org-babel into the buffer, then pandoc handles everything OK.

The one problem I have with pandoc is that when using word export, it loses the table and figure numbers. Mind you, at least I only have to put those in outside emacs :)

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by otikik on Wednesday April 10, 2019 @07:07AM (#19623494)
> Pandoc only handles a subset of org-mode markup.

To me that's got the same drawbacks as "not standardized". If not all of the existing tools support the standard then there are several de facto standards.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by nambit on Wednesday April 10, 2019 @04:55AM (#19622945)
Yeah. I use markdown hosted file and do the markdown -> html conversion entirely clientside via http://dynalon.github.io/mdwiki/#!index.md. I don't think it's possible to do that at all with orgmode?
Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by BeetleB on Wednesday April 10, 2019 @11:03AM (#19625380)
I use Pelican for my static blog, and it takes both markdown and rst. I've automated the process: I convert org to rst using pandoc, and let Pelican take it from there. I literally made a Pelican plugin to do it - so my content directory now just has org files.

So far, I've not seen any major issues.

Re:Org-Mode Is One of the Most Reasonable Markup Languages t... by mruts on Wednesday April 10, 2019 @11:57AM (#19625952)
What’s wrong with pandoc? I use org-mode but only export with pandoc because it works better.