protagonist-react

This project is made, in first place, for the developer.laposte.fr website for render API documentation from API Blueprint.

Usage no npm install needed!

<script type="module">
  import protagonistReact from 'https://cdn.skypack.dev/protagonist-react';
</script>

README

protagonist-react Build Status

This project is made, in first place, for the developer.laposte.fr website for render API documentation from API Blueprint.

It is based on reactstrap and bootstrap v4 css. It is used for Badge and Collapse

We use Highlight.js for body request and response, headers, etc. syntax coloration.

This project contains a list of component and an entry point <Protagonist source={data} />

this entry point has for now only one propTypes :

Protagonist.propTypes = {
  source: React.PropTypes.object,
};

Example

import React from 'react';
import { Protagonist } from 'protagonist-react';

function MyComponent({apibJson}) {
  return (
    <div>
      <Protagonist source={apibJson} />
    </div>
  );
}

This source props is a JSON generated via protagonist which is a nodeJS library for transforming API Blueprint files (.apib) in JSON.

Protagonist

Protagonist must be used with options { type: 'ast' }.

The JSON should looks like :

{
  "_version": "4.0",
  "metadata": [],
  "name": "My API",
  "description": "",
  "element": "category",
  "resourceGroups": []
}

TODO

  • Add a JSON as API documentation example
  • Static website documentation for all components
  • Add Enzyme for tests
  • each component tested
  • Customization
  • More generalist lib
  • Add Storybook
  • Add React-Intl