- Description
- Readme Install
- Contentful Content
- Page Example ➚
- Figma Design System Widget ➚
- Build Information
Project Abbreviation: RDME
Developer Emails: scott.rouse@gmail.com
NPM URL: https://www.npmjs.com/package/contentful-readme-generator
Repo URL: https://github.com/srouse/contentful-readme-generator
This is a service that loads a Contentful entry and renders it as a README file in the repo folder. It has the side effect of being able to use this information for other uses, such as project overviews.
yarn add contentful-readme-generator
# CTFL README
CTFL_README_CONTENTFUL_SPACE=[Your Space Id *]
CTFL_README_CONTENTFUL_ENVIRONMENT=[Your Environment Id *]
CTFL_README_CONTENTFUL_ENTRY_ID=[Your Entry Id *]
CTFL_README_CONTENTFUL_ACCESS_TOKEN=[Your Access Token Id]
- The .env variables are not necessary if using a configuration file.
// ctfl-readme.json
{
"contentfulSpace": "[Your Space Id]",
"contentfulEnvironment": "[Your Env]",
"contentfulEntryId": "[Your Entry Id]",
"rootFilename": "README",
"folderName": "README",
"htmlTemplate": "templates/htmlTemplate.mjs",
"htmlRootFileName": "index",
"htmlDist": "dist"
}
yarn ctfl-readme
There is no specific structure needed to build a readme file, but there are limitations. For instance, ctfl-readme will try to render out whatever you put into your Entry, but text and markdown (large text) are ideal. A simple, but effective example would be:
{
"name": "Readme Project",
"description": "",
"displayField": "title",
"fields": [
{
"id": "title",
"name": "Title",
"type": (TEXT),
...
},
{
"id": "Badges",
"name": "badges",
"type": (JSON),
...
},
{
"id": "tableOfContents",
"name": "Table of Contents",
"type": "Boolean",
"defaultValue": {
"en-US": true
},
...
},
{
"id": "repoUrl",
"name": "Repo URL",
"type": (TEXT, URL VALIDATED),
...
},
{
"id": "description",
"name": "## Description",
"type": (MARKDOWN TEXT),
...
},
{
"id": "howToInstall",
"name": "## How To Install",
"type": (MARKDOWN TEXT),
...
},
Rich Text. Avoid rich text in your Content Type. There is a markdown editor in Contentful, so rich text is a very round about way of getting back to markdown.
ctfl-readme does understand how to create badges via badges. Add a property to your content type with an id of "badges" with the type of JSON and you will be able to pass in a formatted object into badges' renderBadges. Each argument will be a line in the JSON object:
{
"list": [
"npmversion"
],
"config": {
"npmPackageName": "contentful-readme-generator"
},
"options": {}
}
Properties with header characters (#, ##, ###) will be expressed as headers before their content is rendered. This works well for markdown entries. The only special case is "# Title" which will render the actual title instead of the literal word "title".
Adding a property with an id of "tableOfContents" with a type of boolean will trigger (if true) the rendering of a table of contents. It is done via markdown-toc.
There is only one argument where you can change the destination file name
ctfl-readme --fileName README-OTHER.md
Dynamically built using contentful-readme-generator. Do not edit directly.
updated: 6/16/2023, 1:25:07 PM
space: rtkhko6y3s3u
environment: master
entity id: 2Ox6brgaOxUyE0QDuNOAmH