Skip to content

Add source code block interpretation #29

@nicorikken

Description

@nicorikken

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions