Skip to content

Commit

Permalink
Markdown output
Browse files Browse the repository at this point in the history
  • Loading branch information
terwey committed May 11, 2020
1 parent 52adbba commit a02aeef
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ \
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
48 changes: 48 additions & 0 deletions docs/generated/examples.md
Original file line number Diff line number Diff line change
@@ -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.

<div class="note">

We can even use blocks in here if we want.

</div>

**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.
7 changes: 5 additions & 2 deletions docs/readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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/`
Expand Down

0 comments on commit a02aeef

Please sign in to comment.