Members
(private, static, constant) BLOCK_TRANSFORMERS :function
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
"CONTENT_TYPE.MARKDOWN" |
function | |
"CONTENT_TYPE.CODE" |
function | |
"CONTENT_TYPE.CALLOUT" |
function | |
"CONTENT_TYPE.IMAGE" |
function | |
"CONTENT_TYPE.API_HEADER" |
function | |
"CONTENT_TYPE.PARAMETERS" |
function |
Type:
- function
(private, static, constant) BLOCK_TRANSITIONS :string
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
"^\[block:code\]$" |
string | Regex string for start of a code block. |
"^\[block:image\]$" |
string | Regex string for start of an image block. |
"^\[block:callout\]$" |
string | Regex string for start of a callout block. |
"^\[block:parameters\]$" |
string | Regex string for start of a parameters block. |
"^\[block:api\-header\]$" |
string | Regex string for start of an API header block. |
"^\[\/block\]$" |
string | Regex string for the end of a block, and the start of a new markdown block. |
Map of regex strings to content types that follow their appearances. For
information on the structure of each block, see
Content Types
Type:
- string
(private, static, constant) CONTENT_TYPE :string
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
MARKDOWN |
string | Markdown block, containing newlines. |
IMAGE |
string | Image block, containing one or more images with URL, filename, and caption fields |
CODE |
string | Has one or more code blocks, may be flagged for rendering in the sidebar |
CALLOUT |
string | JSON object meant to be displayed as a visually highlighted block of text. |
API_HEADER |
string | JSON object representing a header |
PARAMETERS |
string | JSON object representing a set of possible API endpoint field values (enum); ReadMe organizes it as a set of x/y table coordinate keys mapped to label values. |
ReadMe content types; JSON data structures are parsed as-is, with the exception of CODE elements which receive minor formatting on the internal code strings, with the object structure remaining the same..
Type:
- string
Methods
(static) parse(mdString) → {module:readme-export-parser.DocumentData}
- Source:
Parses a string of ReadMe markdown to a
Document Data object.
Parameters:
| Name | Type | Description |
|---|---|---|
mdString |
string | readme export format markdown string |
Returns:
documentData
Type Definitions
BlockAPIHeaderData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
title |
string | title as markdown |
ReadMe [block:api-header] data structure, as embedded in their markdown
export format. Represents an inline header.
Type:
- object
BlockCalloutData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
type |
string | 'warning', 'info', 'error', or 'success' |
title |
string | title (markdown) |
body |
string | body (markdown) |
ReadMe [block:callout] data structure, as embedded in their markdown
export format. Represents a highlighted visual block of text with a title,
and highlight color varying by type.
Type:
- object
BlockCodeData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
codes |
Array.<module:readme-export-parser.CodeSnippet> | array of code samples, to be displayed in a tabbed container or equivalent (mutually exclusive rendering is implied) |
sidebar |
boolean | if true, the code samples should be rendered in a sidebar next to content, otherwise inline. |
ReadMe [block:code] data structure, as embedded in their markdown
export format. Represents one or more code samples, in potentially
varing languages, meant to be rendered either inline or in a sidebar.
Type:
- object
BlockImageData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
images |
Array.<module:readme-export-parser.Image> | array of images |
ReadMe [block:image] data structure, as embedded in their markdown export
format. Contains an array of Image
objects.
Type:
- object
BlockMarkdownData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
content |
string | markdown string |
ReadMe markdown data structure. All content in a single string.
Type:
- object
BlockParametersData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
data |
object | map of x/y coords to cell contents. Headers have an 'h' X coordinate, with normal cells starting at index 0. Cell contents are markdown. |
rows |
number | row count |
cols |
number | col count |
ReadMe [block:parameters] data structure, as embedded in their markdown
export format. Represents a table of possible API endpoint field values
(enum) as x/y table coordinates mapped to their contents, with headers
having an 'h' X coord.
Type:
- object
CodeSnippet
Properties:
| Name | Type | Description |
|---|---|---|
code |
string | code sample as string |
language |
string | sample language ID, i.e. 'json' |
name |
string | label, i.e. to render as tab title in a tabbed container with multiple samples. |
A single code sample from a ReadMe [block:code] data structure.
Type:
- object
DocumentData
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
title |
string | title from src front matter |
description |
string | description from src front matter |
slug |
string | slug parsed from src front matter |
id |
string | slug in snake-case |
hidden |
boolean | hidden flag |
createdAt |
Date | creation timestamp as Date |
updatedAt |
Date | last update timestamp as Date |
elements |
Array.<(module:readme-export-parser.BlockCalloutData|module:readme-export-parser.BlockAPIHeaderData|module:readme-export-parser.BlockParametersData|module:readme-export-parser.BlockCodeData|module:readme-export-parser.BlockImageData|module:readme-export-parser.BlockMarkdownData)> | array of parsed document blocks |
An object containing all data from a parsed RIO markdown file.
Type:
- object
Image
Properties:
| Name | Type | Description |
|---|---|---|
image |
Array | structure is [URL, filename, ?, ?, bgColor?] |
caption |
string | caption |
A single image from a ReadMe [block:image] data structure.
Type:
- object