mdoc icon indicating copy to clipboard operation
mdoc copied to clipboard

Using the library with asciidoc files

Open raffaele-romeo opened this issue 4 years ago • 1 comments

Hi there,

I would like to use the library with asciidoc (.adoc) files. Do you know if there is already something out there for applying mdoc library on .adoc files and if not, do you think mdoc library is easily extendable for dealing with asciidoc files?

Many Thanks Raffaele

raffaele-romeo avatar Apr 26 '21 09:04 raffaele-romeo

Thank you for reporting! I'm not aware of any efforts or solutions to integrate mdoc with asciidoc. Internally, mdoc isn't easily extendable to other syntaxes but I think it's possible to implement this. If you're interested in taking a stab at it, here's a good place to start looking

https://github.com/scalameta/mdoc/blob/179c110935f208f084a01ca1b74aedf8c3607779/mdoc/src/main/scala-2/mdoc/internal/markdown/MarkdownFile.scala#L62

Markdown rendering happens further down in the same file

https://github.com/scalameta/mdoc/blob/179c110935f208f084a01ca1b74aedf8c3607779/mdoc/src/main/scala-2/mdoc/internal/markdown/MarkdownFile.scala#L95

I'm not familiar with asciidoc but it appears to support almost markdown-like syntax for code fences https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#literals-and-source-code

[source,ruby]
----
require 'sinatra' // <1>

get '/hi' do // <2>
  "Hello World!" // <3>
end
----

It shouldn't be too hard to adapt the mdoc parser to understand that syntax as well.

olafurpg avatar Apr 26 '21 09:04 olafurpg