DEV Community

Rachid Daoudi
Rachid Daoudi

Posted on

2

How to generate beautiful README documentations with README-JSX

README-JSX is a package that lets you write your README documentations in jsx, opening a multitude of new possibilities and oppurtinities to get creative. Not only that, but it also provides you with all the necessary components for writing traditional markdown without having to struggle with spacing and formatting...

Installation

You install the package as a dev dependecy like so npm i -D readme-jsx

Usage

You then create a README.jsx file in the root folder, and proceed to write your jsx code, note that metadata allows you to parse your package.json file properties:

// README.jsx
const React = require("react");
const { BADGE, metadata} = require("readme-jsx");

module.exports = (
  <React.Fragment>
    <BADGE 
    label="LICENSE" 
    message={metadata.license} 
    style="for-the-badge" 
    color="blue" />
  </React.Fragment>
)

Generating README.md

Finally, you launch your script which will generate the README documentation for you:

// /scripts/readme-gen.js
const { generateMD } = require("readme-jsx");
generateMD("./README.jsx").then(() => {
  console.log("README.md generated !");
  process.exit();
});
)
node ./scripts/readme-gen.js

Results

Conclusion

As you could see, writing README.md documentations has never been as easy and flexible as it is now thanks to this package, for a more advanced example, check out this file

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay