diff --git a/Makefile b/Makefile index 1f2166c..0f38458 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ man: markdown: @asciidoctor docs/readme.adoc -b docbook -a leveloffset=+1 -o - | pandoc --atx-headers --wrap=preserve -t gfm -f docbook - > README.md + @asciidoctor docs/generated/examples.adoc -b docbook -a leveloffset=+1 -o - | pandoc --atx-headers --wrap=preserve -t gfm -f docbook - > docs/generated/examples.md proto: @./protoc/bin/protoc -I=examples/ \ diff --git a/README.md b/README.md index db82850..920c549 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,11 @@ Do not set a document header and ToC ## Output -You can view the output of the example below under -[Examples Documentation](https://github.com/productsupcom/code2asciidoc/blob/master/docs/generated/examples.adoc) +You can view the output of the example below in Asciidoc here: +[Examples Documentation in AsciiDoc](https://github.com/productsupcom/code2asciidoc/blob/master/docs/generated/examples.adoc) + +Or as a Markdown version (generated from Asciidoc through Pandoc output) here: +[Examples Documentation in Markdown](https://github.com/productsupcom/code2asciidoc/blob/master/docs/generated/examples.md) ## Example diff --git a/docs/generated/examples.md b/docs/generated/examples.md new file mode 100644 index 0000000..e529185 --- /dev/null +++ b/docs/generated/examples.md @@ -0,0 +1,48 @@ +# examples + +## Example Hello World + +A simple demonstration to show the syntax of code2asciidoc. +You can use any form of asciidoc inside the comments, as it will be +properly parsed by AsciiDoc later. + +What is important is that the function of the test method is the same +as the Tags set below. +Also the name for the CreateJsonSample must match (the name of the current) +package\! + +Be sure to place it inside a filename you can later ingest into your +API docs. Recommended is to keep it per gRPC Service. + +
+ +We can even use blocks in here if we want. + +
+ +**Go Example Hello World.** + +``` go +ex := Example{ + SomeString: "Foo", + SomeInt: 1, +} +``` + +**JSON Example Hello World.** + +``` json +{ + "someString": "Foo", + "someInt": 1 +} +{ + "someString": "Foo", + "someInt": 1 +} +``` + +### Response + +And in some cases you also want to have docs behind the samples to make +data more clear. diff --git a/docs/readme.adoc b/docs/readme.adoc index 392ac53..d4c3d3a 100644 --- a/docs/readme.adoc +++ b/docs/readme.adoc @@ -7,8 +7,11 @@ include::code2asciidoc.adoc[] include::../cmd/code2asciidoc/main.go[tag=options,indent=0] == Output -You can view the output of the example below under -link:https://github.com/productsupcom/code2asciidoc/blob/master/docs/generated/examples.adoc[Examples Documentation] +You can view the output of the example below in Asciidoc here: +link:https://github.com/productsupcom/code2asciidoc/blob/master/docs/generated/examples.adoc[Examples Documentation in AsciiDoc] + +Or as a Markdown version (generated from Asciidoc through Pandoc output) here: +link:https://github.com/productsupcom/code2asciidoc/blob/master/docs/generated/examples.md[Examples Documentation in Markdown] == Example The following file shows a complete example, it's provided inside the `examples/`