Code block justification
Posted by
marc0der on
Sep 08, 2019; 9:04am
URL: https://discuss.asciidoctor.org/Code-block-justification-tp7141.html
Hi all!
I'm currently writing something that has a lot of code blocks where I reference sections of code using tags.
My problem occurs when I reference blocks of indented code. An example would be something like:
object MyObject {
class MyClass {
//tag::init[]
fun myMethod(x: Int): Int = ....
//end::init[]
}
}
This would result the tagged code being indented by 8 characters:
fun myMethod(x: Int): Int = ....
When defining code blocks, each with a different indentation level it feels odd in the final output.
I've looked in the documentation but can't find anything that addresses this specific issue. It would
be great if I could define a tag as follows:
//tag::init[index=-8]
fun myMethod(x: Int): Int = ....
//end::init[]
that would in turn result in everything shifted left by 8 character columns:
fun myMethod(x: Int): Int = ....
Am I just being stupid and overlooking something? is there something I should be doing to achieve this effect?
Thanks for such a fantastic project and hope I can get this working!
Cheers,
Marco.