adoc-mode icon indicating copy to clipboard operation
adoc-mode copied to clipboard

Add source code block interpretation

Open nicorikken opened this issue 7 years ago • 0 comments

The Asciidoc(tor) syntax enables the use of source code blocks.

Currently the content is treated as a literal block, with faulty font-style rendering, and without syntax highlighting or more advanced code re-use options. More advanced features could include the evaluation of a code block.

Example from the Asciidoc manual (ref):

[source,python]
-------------------------------------------
\include::test.py[]
-------------------------------------------

Example from the Asciidoctor manual (ref). Notice the shorter block separators.

[[app-listing]] 
[source,ruby]  
.app.rb 
---- 
require 'sinatra'

get '/hi' do
  "Hello World!"
end
----

In the atom-language-asciidoc package the vastness of language support has been tackled by using a generator script combined with a language definition to automatically generate the needed syntax parsing. This then generates the needed static grammar for the different code languages.

As the parsing in ELisp is done differently, I would assume the implementation itself could be more straightforward. Maybe some hints can be derived from org-mode options, maybe regarding the babel literal programming extension.

nicorikken avatar Oct 01 '16 08:10 nicorikken