AsciiDoc literal blocks, listing blocks and code blocks are converted to formatted blocks in Confluence.
A title can be set for each type of block. The title is rendered as the title of the Confluence panel.
Anchor |
---|
| _literal_block |
---|
| _literal_block |
---|
|
Literal BlockLiteral blocks are converted as pre-formatted text.
No Format |
---|
....
this is a literal block
.... |
Anchor |
---|
| _listing_block |
---|
| _listing_block |
---|
|
Listing BlockListing blocks are converted using the "noformat" macro.
...
No Format |
---|
title | Title of the listing block |
---|
|
this is a listing block |
Anchor |
---|
| _source_block |
---|
| _source_block |
---|
|
Source BlockSource blocks are converted using the "code" macro. Only languages supported by the Code Block Macro can be used: actionscript3
, applescript
, bash
, c#
, cpp
, css
, coldfusion
, delphi
, diff
, erl
, groovy
, xml
, java
, jfx
, js
, php
, perl
, text
, powershell
, py
, ruby
, sql
, sass
, scala
, vb
, yml
(since Confluence 6.7 only)
...
Code Block |
---|
|
public class MyCode {
// comment
} |
Anchor |
---|
| _source_blocks_from_external_files_full_content |
---|
| _source_blocks_from_external_files_full_content |
---|
|
Source Blocks from External Files (Full Content)Including source code from external files is supported:
...
Code Block |
---|
|
public class Source {
// code from included source file
} |
Anchor |
---|
| _source_blocks_from_external_files_partial_content |
---|
| _source_blocks_from_external_files_partial_content |
---|
|
Source Blocks from External Files (Partial Content)Restricting the source code to be included based on tags is supported:
...
Code Block |
---|
|
public void myMethod() {
// method from included source file
} |
Anchor |
---|
| _line_numbers |
---|
| _line_numbers |
---|
|
Line NumbersLine numbers for source blocks can be enabled either using the :source-linenums-option:
attribute globally for all source blocks on the page, or per source block using the linenums
option:
No Format |
---|
[source,java,linenums]
----
public class MyCode {
// comment
}
---- |
Code Block |
---|
language | java |
---|
linenumbers | true |
---|
|
public class MyCode {
// comment
} |
In case no source language is specified for the source block, line numbers have to be enabled using [source%linenums]
(not [source,linenums]
):
No Format |
---|
[source%linenums]
----
line one
line two
line three
---- |
Code Block |
---|
|
line one
line two
line three |
A custom start line number for a source block can be specified using the start
option:
No Format |
---|
[source,java,linenums,start=4]
----
public class MyCode {
// comment
}
---- |
Code Block |
---|
language | java |
---|
firstline | 4 |
---|
linenumbers | true |
---|
|
public class MyCode {
// comment
} |
Anchor |
---|
| _collapsed_source_blocks |
---|
| _collapsed_source_blocks |
---|
|
Collapsed Source BlocksCollapsing of source blocks is supported via the custom collapse
option:
No Format |
---|
[source,java,title="Collapsed Source Block",collapse=true]
----
public class MyCode {
// long source block that should not be visible by default
}
---- |
Code Block |
---|
language | java |
---|
title | Collapsed Source Block |
---|
collapse | true |
---|
|
public class MyCode {
// long source block that should not be visible by default
} |
Info |
---|
Collapsed source blocks are currently not supported by AsciiDoc directly, thus this is a non-standard feature only supported by the Confluence Publisher. |
Anchor |
---|
| _source_highlighting |
---|
| _source_highlighting |
---|
|
Source HighlightingAsciiDoc source highlighters (e.g. CodeRay) are not supported, in favor of using the source highlighting support of Confluence. Thus, any configured AsciiDoc source highlighter is automatically disabled when publishing to Confluence.
Note |
---|
Other advanced features like listing file names or callouts are not supported. |