README
markdown-parse-js (OperationClassification cjs)
js-only operation containing all kinds of functions that help parsing markdown
makes a markdown parse from a markdown string
TODO: markdownStringToMarkdownParse
is a better name. First make a refactor script for this, because it is too hard to rename stuff that is used a lot.
TODO: BUG: it doesn't take into account triple backticks! if there is markdown inside of the triple backticks, it can still be seen as main markdown. Triple backticks are stronger!
Input | ||
---|---|---|
markdownString | string | |
Output |
makes a markdown parse from a markdown string
TODO: markdownStringToMarkdownParse
is a better name. First make a refactor script for this, because it is too hard to rename stuff that is used a lot.
TODO: BUG: it doesn't take into account triple backticks! if there is markdown inside of the triple backticks, it can still be seen as main markdown. Triple backticks are stronger!
Implicit ids are a convention in markdown. A title gets an implicit id by removing spaces and making the title lowercase.
See https://stackoverflow.com/questions/6695439/how-to-link-to-a-named-anchor-in-multimarkdown
Input | ||
---|---|---|
title | string | |
Output | String |
NB: this just uses RAW!
Use markdownParseToMarkdownStringFromContent
for the real deal
Input | ||
---|---|---|
markdownParse | MarkdownParse | |
Output | String |
splits a markdown string into its frontmatter object and the raw content (without frontmatter)
Input | ||
---|---|---|
markdownWithFrontmatter | string | |
Output |
Implicit ids are a convention in markdown. A title gets an implicit id by removing spaces and making the title lowercase.
See https://stackoverflow.com/questions/6695439/how-to-link-to-a-named-anchor-in-multimarkdown
NB: this just uses RAW!
Use markdownParseToMarkdownStringFromContent
for the real deal
splits a markdown string into its frontmatter object and the raw content (without frontmatter)
This function takes a markdown parse and gets the first paragraph and a title from it, if available.
Currently assumes that the first paragraph starts directly after the title or there is no title and the content is at the beginning.
TODO: It would be better to find the first paragraph based on the level.
Input | ||
---|---|---|
markdownParse | { } | |
Output | { title: { }, firstParagraph: { }, } |
This function takes a markdown parse and gets the first paragraph and a title from it, if available.
Currently assumes that the first paragraph starts directly after the title or there is no title and the content is at the beginning.
TODO: It would be better to find the first paragraph based on the level.
Input | ||
---|---|---|
markdownString | string | |
Output | string[] |
Input | ||
---|---|---|
markdownParse | MarkdownParse | |
Output | string |
Show internal (21)
Input | ||
---|---|---|
chunk | MarkdownChunk | |
Output | String |
Get all paragraphs (content
values) recursively from a MarkdownChunk
Input | ||
---|---|---|
chunk | MarkdownChunk | |
Output | string[] |
Gets all paragraphs (recursively) from a MarkdownParse
Input | ||
---|---|---|
markdownParse | MarkdownParse | |
Output | string[] |
Gets all markdown references from a paragraph
Input | ||
---|---|---|
paragraph | string | |
Output | { alt?: string, path: string, isAsset?: boolean, }[] |
recursively parses a string containing markdown (without frontmatter) into a MarkdownChunk[]
Improve:
- include the comment-type (TODO/NB/etc), both on a chunk level and on root level
- parse paragraphs further around the assets
Input | ||
---|---|---|
markdownString | string | |
Output |
Parse markdown paragraph
Should split it up for every thing it encounters...
Input | ||
---|---|---|
paragraph | string | |
Output | { isNewline?: boolean, codeblock?: { type?: string, code?: string, }, text?: string, isBolded?: boolean, isItalic?: boolean, isBackticked?: boolean, reference?: { alt?: string, path: string, isAsset?: boolean, }, }[] |
should get chunks recursively. first just look for every h1 line. everything after the h1 line is the children until there's another h1 line, then do this recursivley for h2, h3, etc.
Input | ||
---|---|---|
markdownString | string | |
Output |
removes header prefix (##### etc) and trims whats behind that
Input | ||
---|---|---|
string | string | |
Output |
Properties:
Name | Type | Description |
---|---|---|
type (optional) | string | |
code (optional) | string |
Properties:
Name | Type | Description |
---|---|---|
isNewline (optional) | boolean | |
codeblock (optional) | object | |
text (optional) | string | |
isBolded (optional) | boolean | |
isItalic (optional) | boolean | |
isBackticked (optional) | boolean | |
reference (optional) | object |
Properties:
Name | Type | Description |
---|---|---|
noFinal (optional) | boolean | |
frontmatterSchema (optional) | object |
Properties:
Name | Type | Description |
---|---|---|
alt (optional) | string | |
path | string | |
isAsset (optional) | boolean |
Get all paragraphs (content
values) recursively from a MarkdownChunk
Gets all paragraphs (recursively) from a MarkdownParse
Gets all markdown references from a paragraph
recursively parses a string containing markdown (without frontmatter) into a MarkdownChunk[]
Improve:
- include the comment-type (TODO/NB/etc), both on a chunk level and on root level
- parse paragraphs further around the assets
Parse markdown paragraph
Should split it up for every thing it encounters...
should get chunks recursively. first just look for every h1 line. everything after the h1 line is the children until there's another h1 line, then do this recursivley for h2, h3, etc.
removes header prefix (##### etc) and trims whats behind that
README
markdown-parse-js (OperationClassification cjs)
js-only operation containing all kinds of functions that help parsing markdown
makes a markdown parse from a markdown string
TODO: markdownStringToMarkdownParse
is a better name. First make a refactor script for this, because it is too hard to rename stuff that is used a lot.
TODO: BUG: it doesn't take into account triple backticks! if there is markdown inside of the triple backticks, it can still be seen as main markdown. Triple backticks are stronger!
Input | ||
---|---|---|
markdownString | string | |
Output |
makes a markdown parse from a markdown string
TODO: markdownStringToMarkdownParse
is a better name. First make a refactor script for this, because it is too hard to rename stuff that is used a lot.
TODO: BUG: it doesn't take into account triple backticks! if there is markdown inside of the triple backticks, it can still be seen as main markdown. Triple backticks are stronger!
Implicit ids are a convention in markdown. A title gets an implicit id by removing spaces and making the title lowercase.
See https://stackoverflow.com/questions/6695439/how-to-link-to-a-named-anchor-in-multimarkdown
Input | ||
---|---|---|
title | string | |
Output | String |
NB: this just uses RAW!
Use markdownParseToMarkdownStringFromContent
for the real deal
Input | ||
---|---|---|
markdownParse | MarkdownParse | |
Output | String |
splits a markdown string into its frontmatter object and the raw content (without frontmatter)
Input | ||
---|---|---|
markdownWithFrontmatter | string | |
Output |
Implicit ids are a convention in markdown. A title gets an implicit id by removing spaces and making the title lowercase.
See https://stackoverflow.com/questions/6695439/how-to-link-to-a-named-anchor-in-multimarkdown
NB: this just uses RAW!
Use markdownParseToMarkdownStringFromContent
for the real deal
splits a markdown string into its frontmatter object and the raw content (without frontmatter)
This function takes a markdown parse and gets the first paragraph and a title from it, if available.
Currently assumes that the first paragraph starts directly after the title or there is no title and the content is at the beginning.
TODO: It would be better to find the first paragraph based on the level.
Input | ||
---|---|---|
markdownParse | { } | |
Output | { title: { }, firstParagraph: { }, } |
This function takes a markdown parse and gets the first paragraph and a title from it, if available.
Currently assumes that the first paragraph starts directly after the title or there is no title and the content is at the beginning.
TODO: It would be better to find the first paragraph based on the level.
Input | ||
---|---|---|
markdownString | string | |
Output | string[] |
Input | ||
---|---|---|
markdownParse | MarkdownParse | |
Output | string |
Show internal (21)
Input | ||
---|---|---|
chunk | MarkdownChunk | |
Output | String |
Get all paragraphs (content
values) recursively from a MarkdownChunk
Input | ||
---|---|---|
chunk | MarkdownChunk | |
Output | string[] |
Gets all paragraphs (recursively) from a MarkdownParse
Input | ||
---|---|---|
markdownParse | MarkdownParse | |
Output | string[] |
Gets all markdown references from a paragraph
Input | ||
---|---|---|
paragraph | string | |
Output | { alt?: string, path: string, isAsset?: boolean, }[] |
recursively parses a string containing markdown (without frontmatter) into a MarkdownChunk[]
Improve:
- include the comment-type (TODO/NB/etc), both on a chunk level and on root level
- parse paragraphs further around the assets
Input | ||
---|---|---|
markdownString | string | |
Output |
Parse markdown paragraph
Should split it up for every thing it encounters...
Input | ||
---|---|---|
paragraph | string | |
Output | { isNewline?: boolean, codeblock?: { type?: string, code?: string, }, text?: string, isBolded?: boolean, isItalic?: boolean, isBackticked?: boolean, reference?: { alt?: string, path: string, isAsset?: boolean, }, }[] |
should get chunks recursively. first just look for every h1 line. everything after the h1 line is the children until there's another h1 line, then do this recursivley for h2, h3, etc.
Input | ||
---|---|---|
markdownString | string | |
Output |
removes header prefix (##### etc) and trims whats behind that
Input | ||
---|---|---|
string | string | |
Output |
Properties:
Name | Type | Description |
---|---|---|
type (optional) | string | |
code (optional) | string |
Properties:
Name | Type | Description |
---|---|---|
isNewline (optional) | boolean | |
codeblock (optional) | object | |
text (optional) | string | |
isBolded (optional) | boolean | |
isItalic (optional) | boolean | |
isBackticked (optional) | boolean | |
reference (optional) | object |
Properties:
Name | Type | Description |
---|---|---|
noFinal (optional) | boolean | |
frontmatterSchema (optional) | object |
Properties:
Name | Type | Description |
---|---|---|
alt (optional) | string | |
path | string | |
isAsset (optional) | boolean |
Get all paragraphs (content
values) recursively from a MarkdownChunk
Gets all paragraphs (recursively) from a MarkdownParse
Gets all markdown references from a paragraph
recursively parses a string containing markdown (without frontmatter) into a MarkdownChunk[]
Improve:
- include the comment-type (TODO/NB/etc), both on a chunk level and on root level
- parse paragraphs further around the assets
Parse markdown paragraph
Should split it up for every thing it encounters...
should get chunks recursively. first just look for every h1 line. everything after the h1 line is the children until there's another h1 line, then do this recursivley for h2, h3, etc.
removes header prefix (##### etc) and trims whats behind that