Re: Markdown -> Asciidoc converter
Posted by
mojavelinux on
Oct 13, 2018; 8:36am
URL: https://discuss.asciidoctor.org/Markdown-Asciidoc-converter-tp6014p6519.html
The Markdown to AsciiDoc converter has been drastically improved. It also has much better documentation. If you're still looking for a solution, I encourage you to check it out. It can also be installed from
rubygems.org.
Feel free to file issues in that repository if you find something that doesn't work.
Cheers,
-Dan
On Thu, Nov 9, 2017 at 1:43 AM Sisyphos [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Hi Dan,
Thank you very much for your quick answer. I greatly admire your dedication to Asciidoc. A great project.
Most of it looks good. The headings have no index and are simply converted to a "=" character. That looks nice.
I have stumbled on two things: Unfortunately, I use front matter in Jekyll style for my files. eg:
---
title: Title of my Doc
---
As far as I understand kramdown, the "---" characters there are just horizontal rules (https://kramdown.gettalong.org/syntax.html#horizontal-rules). If that in adoc-files also become horizontal rules, that would be fine for me. Unfortunately kramdown-asciidoc doesn't like that at all:
/data1/Software/kramdown-asciidoc/lib/kramdown-asciidoc/converter.rb:21:in `block in inner': undefined method `convert_hr' for #<Kramdown::Converter::Asciidoc:0x00556ba829fa68> (NoMethodError)
Did you mean? convert_br
convert_header
convert
convert_a
convert_p
convert_root
convert_li
convert_ol
convert_ul
convert_em
convert_strong
convert_img
from /data1/Software/kramdown-asciidoc/lib/kramdown-asciidoc/converter.rb:17:in `each'
from /data1/Software/kramdown-asciidoc/lib/kramdown-asciidoc/converter.rb:17:in `each_with_index'
from /data1/Software/kramdown-asciidoc/lib/kramdown-asciidoc/converter.rb:17:in `inner'
from /data1/Software/kramdown-asciidoc/lib/kramdown-asciidoc/converter.rb:29:in `convert_root'
from /data1/Software/kramdown-asciidoc/lib/kramdown-asciidoc/converter.rb:10:in `convert'
from /var/lib/gems/2.3.0/gems/kramdown-1.15.0/lib/kramdown/converter/base.rb:105:in `convert'
from /var/lib/gems/2.3.0/gems/kramdown-1.15.0/lib/kramdown/document.rb:117:in `method_missing'
from bin/kramdown-asciidoc:24:in `<main>'
However, since front matters are not part of kramdown, I don't see this as a bug.
A structural problem is somewhat more serious. As far as I understand asciidoc, texts with one leading "=" are interpreted as document headers. kramdown-asciidoc converts the levels one to one, which means that there are several document headers.
Since you can't know what kind of title the author wants without front matter, I would suggest that the headlines be moved down one level during conversion. (So "#" becomes "=="). After the conversion, I would simply set a document header by myself.
Regards,
Benjamin
--