Home

Awesome

dropwizard-markdown-assets-bundle

CircleCI

An assets bundle (like io.dropwizard.assets.AssetsBundle) that allows a dropwizard app to render and serve Markdown documents from the classpath. The goal is to provide a way to quickly and easily serve up static documentation for a service, taking advantage of Markdown's ease of editing and reusability. For example:

A basic demo 'application' (consisting of documentation examples and nothing more) can be seen here (see here for source code).

In the 'out of the box' configuration (with default template and stylesheet) the following additional features are supported:

Usage

Basic setup

<dependency>
    <groupId>org.rnorth.dropwizard</groupId>
    <artifactId>dropwizard-markdown-assets-bundle</artifactId>
    <version>1.0.4</version>
</dependency>

public static class TestConfiguration extends Configuration implements MarkdownBundleConfiguration {

    public MarkdownAssetsConfiguration assets = new MarkdownAssetsConfiguration();

    @Override
    public MarkdownAssetsConfiguration getMarkdownAssetsConfiguration() {
        return assets;
    }
}
        @Override
        public void initialize(Bootstrap<TestConfiguration> bootstrap) {
            bootstrap.addBundle(new MarkdownAssetsBundle());
        }

Customising behaviour

The following fluent setter methods on MarkdownAssetsBundle allow its behaviour to be customized:

Through configuration, on a per-environment basis the following may also be set:

Customizing template and stylesheet

A default page template and CSS stylesheet are included to serve as a default baseline for use. These defaults can be found inside this module at /default-dropwizard-markdown-template.ftl and /default-dropwizard-markdown.css respectively.

The page template is defined with Freemarker, and defines the structure that rendered markdown content will be placed into.

To replace either/both with your own, simply place a file named template.ftl or dropwizard-markdown.css in your resourcePath location (the root folder for markdown assets).

Licence

See LICENSE

Copyright

(c) Richard North 2016

Acknowledgements

This library takes inspiration from or utilizes:

Changelog

1.0.4

1.0.3

1.0.2

1.0.1

1.0.0

Initial release