-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from jp7677/asciidoc-support
Asciidoc support
- Loading branch information
Showing
31 changed files
with
811 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
= AsciiDoc features | ||
:toc: macro | ||
:imagesdir: ../assets | ||
:tip-caption: 💡Tip | ||
|
||
== AsciiDoc features 📌 | ||
|
||
This page showcases the ability to use AsciiDoc formating features in workspace documentation files. The full list of AsciiDoc features is documented in the https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/[Asciidoctor Syntax Reerence]. | ||
|
||
toc::[] | ||
|
||
=== Embedding diagrams | ||
|
||
Diagrams can be embedded using the `embed:` syntax: | ||
|
||
[source, asciidoc] | ||
---- | ||
image::embed:SystemLandscape[System Landscape Diagram] | ||
---- | ||
|
||
See also: https://www.structurizr.com/help/documentation/diagrams | ||
|
||
==== Example: Embedded diagram | ||
|
||
image::embed:SystemLandscape[System Landscape Diagram] | ||
|
||
=== Embedding static images | ||
|
||
==== Example Embedded picture | ||
|
||
When, for example, you would like to embed a nice picture which is located in the `pictures` directory under the assets directory, you can do that as follows: | ||
|
||
[source, asciidoc] | ||
---- | ||
image::/pictures/nice-picture.png[A nice picture] | ||
---- | ||
|
||
https://www.flickr.com/photos/schmollmolch/4937297813/[Sun], by Christian Scheja | ||
|
||
image::/pictures/nice-picture.png[A nice picture] | ||
|
||
=== Embedding mermaid diagrams | ||
|
||
==== Flowchart Diagram Example | ||
|
||
[source, asciidoc] | ||
----- | ||
[source, mermaid] | ||
---- | ||
graph TD; | ||
A-->B; | ||
A-->C; | ||
B-->D; | ||
C-->D; | ||
---- | ||
----- | ||
|
||
[source, mermaid] | ||
---- | ||
graph TD; | ||
A-->B; | ||
A-->C; | ||
B-->D; | ||
C-->D; | ||
---- | ||
|
||
==== Sequence Diagram Example | ||
|
||
[source, asciidoc] | ||
----- | ||
[source, mermaid] | ||
---- | ||
sequenceDiagram | ||
participant Alice | ||
participant Bob | ||
Alice->>John: Hello John, how are you? | ||
loop Healthcheck | ||
John->>John: Fight against hypochondria | ||
end | ||
Note right of John: Rational thoughts <br/>prevail! | ||
John-->>Alice: Great! | ||
John->>Bob: How about you? | ||
Bob-->>John: Jolly good! | ||
---- | ||
----- | ||
|
||
[source, mermaid] | ||
---- | ||
sequenceDiagram | ||
participant Alice | ||
participant Bob | ||
Alice->>John: Hello John, how are you? | ||
loop Healthcheck | ||
John->>John: Fight against hypochondria | ||
end | ||
Note right of John: Rational thoughts <br/>prevail! | ||
John-->>Alice: Great! | ||
John->>Bob: How about you? | ||
Bob-->>John: Jolly good! | ||
---- | ||
|
||
=== Tables | ||
|
||
[source, asciidoc] | ||
---- | ||
|=== | ||
|Column 1, Header Row |Column 2, Header Row | ||
|Cell in column 1, row 1 | ||
|Cell in column 2, row 1 | ||
|Cell in column 1, row 2 | ||
|Cell in column 2, row 2 | ||
|=== | ||
---- | ||
|
||
This will be rendered as | ||
|
||
|=== | ||
|Column 1, Header Row |Column 2, Header Row | ||
|
||
|Cell in column 1, row 1 | ||
|Cell in column 2, row 1 | ||
|
||
|Cell in column 1, row 2 | ||
|Cell in column 2, row 2 | ||
|=== | ||
|
||
=== Admonition Blocks | ||
|
||
Admonitions create block-styled side content. | ||
|
||
NOTE: This is a note. | ||
|
||
[TIP] | ||
.Info | ||
===== | ||
Go to this URL to learn more about it: | ||
* https://docs.asciidoctor.org/asciidoc/latest/blocks/admonitions/ | ||
CAUTION: This is Caution message! | ||
WARNING: This is a Warning message! | ||
===== | ||
|
||
[IMPORTANT] | ||
One more thing. Happy documenting! | ||
|
||
=== Block quotes | ||
|
||
[quote,attribution,citation title and information] | ||
Quote or excerpt text | ||
|
||
=== Checklist | ||
|
||
[source, asciidoc] | ||
---- | ||
* [*] checked | ||
* [x] also checked | ||
* [ ] not checked | ||
* normal list item | ||
---- | ||
|
||
will be rendered as: | ||
|
||
* [*] checked | ||
* [x] also checked | ||
* [ ] not checked | ||
* normal list item |
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/Asciidoctor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package nl.avisi.structurizr.site.generatr.site.model | ||
|
||
import org.asciidoctor.Asciidoctor | ||
import org.asciidoctor.ast.ContentNode | ||
import org.asciidoctor.ast.Document | ||
import org.asciidoctor.ast.StructuralNode | ||
import org.asciidoctor.converter.ConverterFor | ||
import org.asciidoctor.converter.StringConverter | ||
|
||
val asciidoctor: Asciidoctor = Asciidoctor.Factory.create().apply { | ||
javaConverterRegistry().register(AsciiDocTextConverter::class.java) | ||
} | ||
|
||
@ConverterFor("text") | ||
class AsciiDocTextConverter( | ||
backend: String?, | ||
opts: Map<String?, Any?>? | ||
) : StringConverter(backend, opts) { | ||
// based on https://docs.asciidoctor.org/asciidoctorj/latest/write-converter/ | ||
|
||
override fun convert(node: ContentNode, transform: String?, o: Map<Any?, Any?>?): String? { | ||
val transform1 = transform ?: node.nodeName | ||
return if (node is Document) | ||
node.content.toString() | ||
else if (node is org.asciidoctor.ast.Section) | ||
"${node.title}\n${node.content}" | ||
else if (transform1 == "preamble" || transform1 == "paragraph") | ||
(node as StructuralNode).content as String | ||
else | ||
null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/HomePageViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.