markup-document-builder

A Markup (Markdown, AsciiDoc) document builder

License

License

Categories

Categories

Swagger Program Interface REST Frameworks
GroupId

GroupId

io.github.swagger2markup
ArtifactId

ArtifactId

markup-document-builder
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

markup-document-builder
A Markup (Markdown, AsciiDoc) document builder
Project URL

Project URL

https://github.com/Swagger2Markup/markup-document-builder
Source Code Management

Source Code Management

https://github.com/Swagger2Markup/markup-document-builder.git

Download markup-document-builder

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.swagger2markup/markup-document-builder/ -->
<dependency>
    <groupId>io.github.swagger2markup</groupId>
    <artifactId>markup-document-builder</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.swagger2markup/markup-document-builder/
implementation 'io.github.swagger2markup:markup-document-builder:1.1.2'
// https://jarcasting.com/artifacts/io.github.swagger2markup/markup-document-builder/
implementation ("io.github.swagger2markup:markup-document-builder:1.1.2")
'io.github.swagger2markup:markup-document-builder:jar:1.1.2'
<dependency org="io.github.swagger2markup" name="markup-document-builder" rev="1.1.2">
  <artifact name="markup-document-builder" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.swagger2markup', module='markup-document-builder', version='1.1.2')
)
libraryDependencies += "io.github.swagger2markup" % "markup-document-builder" % "1.1.2"
[io.github.swagger2markup/markup-document-builder "1.1.2"]

Dependencies

compile (5)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.18
org.apache.commons : commons-lang3 jar 3.4
commons-io : commons-io jar 2.4
commons-codec : commons-codec jar 1.10
nl.jworks.markdown_to_asciidoc » markdown_to_asciidoc jar 1.0

Project Modules

There are no modules declared in this project.

MarkupDocBuilder

Build Status Coverage Status Codacy code quality download Apache License 2 Twitter

Overview

This project is a Markup document builder (AsciiDoc, Markdown and ConfluenceWiki). The primary goal of this project is to simplify the creation of Markup documents. The builder is used by swagger2markup.

The project requires at least JDK 7.

Usage

Adding MarkupDocBuilder to your project

The project is published in JCenter and Maven Central.

Maven

<repositories>
    <repository>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <id>central</id>
        <name>bintray</name>
        <url>http://jcenter.bintray.com</url>
    </repository>
</repositories>
<dependency>
    <groupId>io.github.swagger2markup</groupId>
    <artifactId>markup-document-builder</artifactId>
    <version>1.1.1</version>
</dependency>

Gradle

repositories {
    jcenter()
}

compile "io.github.swagger2markup:markup-document-builder:1.1.1"

Using MarkupDocBuilder

The MarkupDocBuilder allows to build an AsciiDoc or Markdown document via the Builder pattern.

public class MarkupDocBuilderTest {

    List<String> tableRowsInPSV;

    @Before
    public void setUp(){
        tableRowsInPSV = new ArrayList<>();
        tableRowsInPSV.add("Header 1 | Header 2 | Header2");
        tableRowsInPSV.add("Row 1, Column 1 | Row 1, Column 2 | Row 1, Column 3");
        tableRowsInPSV.add("Row 2, Column 1 | Row 2, Column 2 | Row 2, Column 3");
    }


    @Test
    public void testToAsciiDocFile() throws IOException {
        MarkupDocBuilder builder = MarkupDocBuilders.documentBuilder(MarkupLanguage.ASCIIDOC);
        builder.documentTitle("Test title")
                .sectionTitleLevel1("Section Level 1a")
                .sectionTitleLevel2("Section Level 2a")
                .sectionTitleLevel3("Section Level 3a")
                .paragraph("Paragraph with long text bla bla bla bla bla")
                .listing("Source code listing")
                .source("MarkupDocBuilder builder = MarkupDocBuilders.documentBuilder(MarkupLanguage.ASCIIDOC)", "java")
                .tableWithHeaderRow(tableRowsInPSV)
                .sectionTitleLevel1("Section Level 1b")
                .sectionTitleLevel2("Section Level 2b")
                .boldTextLine("Bold text line b")
                .italicTextLine("Italic text line b")
                .unorderedList(Arrays.asList("Entry1", "Entry2", "Entry 2"))
                .writeToFile("build/tmp", "test", StandardCharsets.UTF_8);
    }

    @Test
     public void testToMarkdownDocFile() throws IOException {
        MarkupDocBuilder builder = MarkupDocBuilders.documentBuilder(MarkupLanguage.MARKDOWN);
        builder.documentTitle("Test title")
                .sectionTitleLevel1("Section Level 1a")
                .sectionTitleLevel2("Section Level 2a")
                .sectionTitleLevel3("Section Level 3a")
                .paragraph("Paragraph with long text bla bla bla bla bla")
                .listing("Source code listing")
                .source("MarkupDocBuilder builder = MarkupDocBuilders.documentBuilder(MarkupLanguage.MARKDOWN)", "java")
                .tableWithHeaderRow(tableRowsInPSV)
                .sectionTitleLevel1("Section Level 1b")
                .sectionTitleLevel2("Section Level 2b")
                .boldTextLine("Bold text line b")
                .italicTextLine("Italic text line b")
                .unorderedList(Arrays.asList("Entry1", "Entry2", "Entry 2"))
                .writeToFile("build/tmp", "test", StandardCharsets.UTF_8);
    }

}

Generated HTML using AsciidoctorJ

You can generate your PDF or HTML documentation via asciidoctorj or even better via the asciidoctor-gradle-plugin or markdown-gradle-plugin.

asciidoc_html

License

Copyright 2015 Robert Winkler

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

io.github.swagger2markup

Swagger2markup

A Swagger to AsciiDoc or Markdown converter to simplify the generation of an up-to-date RESTful API documentation (HTML, PDF).

Versions

Version
1.1.2
1.1.1
1.1.0
1.0.0