RAML to HTML documentation generator.

Overview

raml2html

Downloads NPM version Prettier

A simple RAML to HTML documentation generator, written for Node.js, with theme support.

RAML version support

raml2html 4 and higher only support RAML 1.0 files. Please stick with raml2html 3.x for RAML 0.8 support.

Install

npm i -g raml2html

Themes

raml2html ships with a default theme, but you can install more from NPM. For example, to render RAML to Markdown, you can install the raml2html-markdown-theme theme:

npm i -g raml2html-markdown-theme

Search NPM for the "raml2html-theme" keyword (or use this link) to find more themes.

Usage

As a command line script

raml2html --help
raml2html example.raml > example.html
raml2html --theme raml2html-markdown-theme example.raml > example.html
raml2html --template my-custom-template.nunjucks -i example.raml -o example.html

As a library

Using the default theme, different themes, or your own Nunjucks templates

const raml2html = require('raml2html');
const configWithDefaultTheme = raml2html.getConfigForTheme();
const configForDifferentTheme = raml2html.getConfigForTheme('raml2html-markdown-theme');
const configWithCustomTemplate = raml2html.getConfigForTemplate('~/path/to/my-custom-template.nunjucks');

// source can either be a filename, url, or parsed RAML object
raml2html.render(source, configWithDefaultTheme).then(function(result) {
  // Save the result to a file or do something else with the result
}, function(error) {
  // Output error
});

Using your own processing function, for full control over the whole rendering process

/**
 * config should be an object with at least an `processRamlObj` property which is a function that receives the raw RAML
 * object and must return a promise with the result. You can do whatever you want in this function.
 *
 * You can also supply a postProcessHtml function that can for example minify the generated HTML.
 * 
 * You can also supply a writeOutput function that takes over writing the output (to disk for example).
 *
 * You can also supply a setupNunjucks function that takes the env as its only parameter.
 */
raml2html.render(source, config).then(function(result) {
  // Save the result to a file or do something else with the result
}, function(error) {
  // Output error
});

See also examples/script.js for multiple examples of using raml2html as a library.

Example output

Please see the following links for live examples:

Before you report a bug

If you get parsing errors, please do not report them to raml2html: it doesn't do the actual RAML parsing. Review the error and fix your RAML file, or open a new issue at raml-js-parser-2.

Contributing

raml2html is an open source project and your contribution is very much appreciated.

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  2. Fork the repository on Github and make your changes on the develop branch (or branch off of it). Run npm run lint before committing to check for common problems and auto format all code.
  3. Add an example of the new feature to example.raml (if applicable)
  4. Send a pull request (with the develop branch as the target).

If your pull request is merged feel free to ask for push access. We want to get more maintainers! If you do have push access, please still work on feature branches and create pull requests, which then get reviewed. You can also review other people's pull requests and be involved in that way.

A big thank you goes out to everyone who helped with the project, the contributors and everyone who took the time to report issues and give feedback.

Local setup

To get the best environment to work on raml2html and the default theme, follow these steps.

  1. Checkout raml2html-default-theme's develop branch; npm link.
  2. Checkout raml2html's develop branch; first npm link raml2html-default-theme and then npm link.
  3. In raml2html-default-theme run npm link raml2html.

Now both projects are installed globally, but using the local development versions of both. From the theme repo's examples folder you can run the render-all-examples script without problem.

Changelog

See changelog.md

License

raml2html is available under the MIT license. See the LICENSE file for more info.

Comments
  • Fix bug of show `[object Object]` in Example

    Fix bug of show `[object Object]` in Example

    In raml1.0 branch, I write a JSON string in example field, but it will show [object Object].

    Problem

    /box:
      get:
        responses:
          200:
            body:
              application/json:
                example: |
                  {}
    

    to

    2016-05-25 8 24 13

    opened by jhen0409 12
  • Method Detail Display Improvement

    Method Detail Display Improvement

    I didn't like the UI/X of the modal dialog, and it disallowed the ability to look at more than one at a time. This is a possible solution; which may still need some cleanup but gets the idea across.

    opened by kalisjoshua 12
  • BUG: fix uriParameter not showing up correctly in nested paths

    BUG: fix uriParameter not showing up correctly in nested paths

    uriParameters did not show up in paths like this /something/{id}/something/{foo}/bar

    In this case, uriParameters was completely empty. My code change allows both {id} and {foo} to show up.

    However, I'm new to handlebars and couldn't figure out how to make this a conditional. i.e. now uriParameters show up whether it's populated or not.

    Also, this is probably not the best way of doing this, so if you have a better idea and hadn't noticed the bug, you should probably scrap this ;)

    opened by danielb2 12
  • initial PR for raml1.0 support

    initial PR for raml1.0 support

    Since 2.5.0 introduced a lot of changes and conflic resolution when merging develop back to raml1.0 was almost impossible, @kevinrenskers asked to basically create a new branch and apply all the changes. This PR does that. Several notes here:

    • I had to change the ramlObj.securitySchemeWithName function back using a for instead of find since it was not working.
    • There are some displaying issues (see images below)

    Can everyone who participated updating the RAML 1.0 branch check this again please and give a LGTM? (cc/ @ivokh @edentsai @jerrobertson)

    It was quite some work and I really hope I did not miss anything. The tests that I have run look good to me.

    Displaying issues:

    Here the rendering for the second property that is also a type is really strange - it should be a bullet point

    issue_1

    Should we really display Type: if there is no type.

    issue_2

    opened by sichvoge 11
  • URL navigation on modal dialogs

    URL navigation on modal dialogs

    Hi,

    I missed a possibility to link directly to opened modal. So I implemented this feature.

    • link links directly to #{{../uniqueId}}_{{method}}
    • jquery observes hashchange event

    The examples are also regerenerated. It can be seen here as well: http://rawgit.com/zbycz/raml2html/patch-1/examples/example.html#_forecasts__geoposition__get

    Thanks for merging or any comments :-)

    opened by zbycz 10
  • allow themes to copy assets to the output directory

    allow themes to copy assets to the output directory

    Hey,

    this PR adds support for themes to add their own assets to the output directory of the html file. The primary reason for adding this feature is that I need a theme that bundles its assets in order to provide api documentation on local networks that don’t have access to the internet.

    Themes may define a copyAssets method as part of their config. If they do the function will receive the target directory of the output file as their only argument and should return a Promise to indicate completion. I thought about adding some logic to handle things like strings as arguments for the copyAssets config option, but that is likely to fall short in terms of what people might want to do with this. The theme should know best how to handle its assets.

    I wasn’t quite sure where to add the documentation for this. If there is a theme guide somewhere I'll be happy to submit a pull request.

    Thank you for your time and your work you put into this project!

    opened by kmohrf 9
  • Implement two new sources (data and obj) as well as the existing file source

    Implement two new sources (data and obj) as well as the existing file source

    This fixes #9. Steps taken:

    1. Added function parseSource() to take a source (can be a string to be backwards compatible or an object containing either file, data or obj property). It returns the corresponding RAML object.
    2. Refactored HTML generation out in its own function compileRamlObj().
    3. Updated parseWithConfig() to invoke parseSource() followed by compileRamlObj() with the RAML object.
    4. Updated main call to parse() to reflect that source argument now can be an object.
    5. Added parseSource() to exported functions.
    opened by walling 8
  • Add 'audience' param

    Add 'audience' param

    Improvement for ticket #377.

    Adds an --audience parameter that allows passing a value to the template. This allows conditional formatting of the output.

    opened by ArtFlag 7
  • raml2html as a Docker image

    raml2html as a Docker image

    opened by mstrzele 7
  • Nuke https option

    Nuke https option

    If we use '//' instead of specifying a protocol, then we don't actually need to care what protocol the user's server is using.

    (Sorry, I submitted the previous pull request before I'd actually read the entire README. Rebased on your develop branch and now resubmitting.)

    opened by clee 7
  • Generate Descriptions for ALL resources, not only at top-level

    Generate Descriptions for ALL resources, not only at top-level

    This PR solves the problem also discussed in #50.

    Pro:

    • fixes neglected endpoint descriptions

    Con:

    • will generate an even more condensed documentation, so we're losing some usability value given with overview description being visible initially.
    opened by Philzen 7
Log4j-payload-generator - Log4j jndi injects the Payload generator

0x01 简介 log4j-payload-generator是 woodpecker框架 生产log4 jndi注入漏洞payload的插件。目前可以一键生产以下5类payload。 原始payload {[upper|lower]:x}类型随机混payload {[upper|lower]:x}

null 469 Dec 30, 2022
OpenApi Generator - REST Client Generator

Quarkus - Openapi Generator Welcome to Quarkiverse! Congratulations and thank you for creating a new Quarkus extension project in Quarkiverse! Feel fr

Quarkiverse Hub 46 Jan 3, 2023
Public documentation for Visual Studio Code

Visual Studio Code Documentation You've found the Visual Studio Code documentation GitHub repository, which contains the content for the Visual Studio

Microsoft 4.8k Jan 8, 2023
This repo holds all the basic code and documentation to the ev3 roboter of group 3 from WS21/22

e3base This repo holds all the basic code and documentation to the ev3 roboter of group 3 from WS21/22 Task Every group had to build a roboter using t

Jonas Deipenbrock 1 Feb 12, 2022
A backend for Asciidoctor used to produce Spring styled HTML

Asciidoctor Spring Backends Alternative HTML conversion for Asciidoctor with a Spring "look and feel". Maven build integration You can use the Asciido

Spring IO 40 Dec 14, 2022
Student management system with sql database,Jsp & Java (Front end with HTML & CSS)

studentmanagementsystem Student management system with sql database,Jsp & Java (Front end with HTML & CSS) what this basically is that it integrates t

Isaac 7 Oct 3, 2022
A fractal generator

FractalMatic This app is a simple 2d fractal generator that uses JavaFx framework. Fractalmatic has only one type of fractal at the moment, but the pl

Zeynel 25 Oct 18, 2022
Universal, flexible, high-performance distributed ID generator

CosId Universal, flexible, high-performance distributed ID generator 中文文档 Introduction CosId aims to provide a universal, flexible and high-performanc

Ahoo Wang 256 Dec 27, 2022
Java XMLDecoder payload generator

0x01 简介 xmldecoder-payload-generator是woodpecker框架快速生成XMLDecoder荷载插件,目前支持如下payload生成: sleep dnslog socket log httplog execute command jndi bcel bcel wi

null 14 Jul 6, 2022
Record builder generator for Java records

RecordBuilder What is RecordBuilder Java 16 introduces Records. While this version of records is fantastic, it's currently missing some important feat

Jordan Zimmerman 361 Dec 27, 2022
Java based open source static site/blog generator for developers & designers.

JBake JBake is a Java based open source static site/blog generator for developers. Documentation Full documentation is available on jbake.org. Contrib

JBake 1k Dec 30, 2022
The simple, R+D and Innovation Evidences Generator

R+D and Innovation Evidences Generator Evidences Generator The simple, R+D and Innovation Evidences Generator Project status As of January 1, 2022, Ev

Ramón Granda García 1 Jan 21, 2022
The KubeJS data dumper and dynamic typing generator.

ProbeJS A data dumper and typing generator for the KubeJS functions, constants and classes. Great thanks to @DAmNRelentless, @LatvianModder and @yeste

Li Junyu 22 Dec 8, 2022
A simple QR-code generator.

javaQR-generator A simple QR-code generator. Installation instructions. *Note: in order to build this program you must have JDK v1.8 or greater proper

Yoel N. Fabelo González 1 May 18, 2022
Distributed id generator application

Java distributed Unique ID generator inspired by Twitter snowflake You can read about Twitter snowflake here. The IDs are 64-bits in size and are gene

Mert Aksu 6 Oct 21, 2021
Java SQL (JDBC) code generator with GUI. SQL and OOP finally united.

jSQL-Gen Java SQL (JDBC) code generator with GUI. SQL and OOP finally united. Usage Install the latest release. Create a database, tables and their co

Osiris-Team 11 Nov 14, 2022
Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

中文README传送门 What is Auto-Unit-Test-Case-Generator Auto-Unit-Test-Case-Generator generates JUnit test suites for Java class just as its name. During te

TRaaS 108 Dec 22, 2022
OpenAPI JSON Schema Generator allows auto-generation of API client libraries with a focus on JSON schema given an OpenAPI Spec

OpenAPI JSON Schema Generator IMPORTANT: before the first release, one will need to build the project locally to use the enhancements, bug fixes in th

OpenAPI Tools 5 Dec 31, 2022
jsoup: the Java HTML parser, built for HTML editing, cleaning, scraping, and XSS safety.

jsoup: Java HTML Parser jsoup is a Java library for working with real-world HTML. It provides a very convenient API for fetching URLs and extracting a

Jonathan Hedley 9.9k Jan 4, 2023
hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java.

Hella easy HTML in Java hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java. Very lightweight and fast, the prim

null 1 Nov 23, 2022