Various markdown related parsing, processing and stringification utilities.
$ npm install @adobe/helix-markdown-support
See the API documentation.
$ npm install
$ npm test
$ npm run lint
Various markdown related parsing, processing and stringification utilities.
License: Apache License 2.0
Various markdown related parsing, processing and stringification utilities.
$ npm install @adobe/helix-markdown-support
See the API documentation.
$ npm install
$ npm test
$ npm run lint
micromark uses conditional package exports:
https://github.com/micromark/micromark/blob/9a3a2dd28b996049fe7de46d6e6f905d20bf5caf/packages/micromark/package.json#L56-L57
those are imported, depending on the --conditions
argument:
https://nodejs.org/docs/latest-v14.x/api/packages.html#packages_resolving_user_conditions
the frontmatter tests fail with --conditions=development
the problem with markdown tables is, that the cells can't contain container elements. so for tables with container elements, we use html tables. so far word2md used to convert the entire sub-tree to html.
according to https://spec.commonmark.org/0.29/#html-block, a HTML block is terminated by a blank line.
example:
<table><tr><td align="right">
**Hello**,
_world_.
</td></tr>
<tr><td>
1. hello
2. world and a very long line.
</td></tr></table>
github rendering test:
Hello, world. |
|
Note: Since the output might be different than the current conversion, this change should be considered breaking.
Relates to https://github.com/adobe/helix-word2md/issues/703
When an MDAST contains table cells with nodes of type html
, conversion of those table to HTML cause issues. Reason is the following line:
The inner function md2hast
returns null
because it considers nodes of type html
dangerous, so the subsequent invocation of hast2html
fails.
Research if https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-grid-tables can be used for grid tables in helix
also see: https://pandoc.org/MANUAL.html#extension-grid_tables
GridTables look like this:
+-------------------+------+
| Table Headings | Here |
+--------+----------+------+
| Sub | Headings | Too |
+========+=================+
| cell | column spanning |
| spans +---------:+------+
| rows | normal | cell |
+---v----+:---------------:+
| | cells can be |
| | *formatted* |
| | **paragraphs** |
| | ``` |
| multi | and contain |
| line | blocks |
| cells | ``` |
+========+=========<+======+
| footer | cells | |
+--------+----------+------+
+-
followed by some -
or +
and finished by -+
.=
as grid line.|
) delimiters-
) delimiters:
or ><
v
^
x
)=
).|
)+
) in the row delimiters, if the cell content|
, otherwise the correct layout of the table can't be guaranteed.The table layout tries to keep the table within a certain width (default 120). For example,
if the table has 3 columns, each column will be max 40 characters wide. If all text in a column
is smaller, it will shrink the columns. However, cells have a minimum width (default 10) when
text needs to be broken. If the cell contents need more space, e.g. with a nested table or
code block, it will grow accordingly.
Horizontal align is indicated by placing markers at the grid line above the cell:
Justify Center Left Right
+>-----<+ +:-----:+ +:------+ +------:+
| A b C | | ABC | | ABC | | ABC |
+-------+ +-------+ +-------+ +-------+
Vertical align is indicated by placing markers at the center of the grid line above the cell:
Top Middle Bottom
+---^---+ +---x---+ +---v---+
| Larum | | | | |
| Ipsum | | Larum | | |
| | | Ipsum | | Larum |
| | | | | Ipsum |
+-------+ +-------+ +-------+
gridTable := tbd;
Note: the top of a cell must be indicated by +-
followed by some -
or +
and finished by -+
.
So, this is not a correct table:
+--+
|a |
+--+
But, this is a correct table:
+---+
| a |
+---+
The following interfaces are added to [mdast][] by this utility.
GridTable
interface GridTable <: Parent {
type: "gridTable"
children: [GridTableHeader|GridTableBody|GridTableFooter]
}
GridTableHeader
interface GridTableHeader <: Parent {
type: "gtHead"
children: [GridTableRow]
}
GridTableBody
interface GridTableBody <: Parent {
type: "gtBody"
children: [GridTableRow]
}
GridTableFoot
interface GridTableFooter <: Parent {
type: "gtFoot"
children: [GridTableRow]
}
GridTableRow
interface GridTableRow <: Parent {
type: "gtRow"
children: [GridTableCell]
}
GridTableCell
interface GridTableCell <: Parent {
type: "gtCell"
colSpan: number >= 1
rowSpan: number >= 1
align: alignType
valign: valignType
children: [MdastContent]
}
GridTableCell ([Parent][dfn-parent]) represents a header cell in a
[GridTable][dfn-table], if its parent is a [gridTableHead][term-head], or a data
cell otherwise.
GridTableCell can be used where [gridTableRow][dfn-row-content] content is expected.
Its content model is [mdast][dfn-phrasing-content] content, allowing full mdast documents.
alignType
enum alignType {
"left" | "right" | "center" | "justify" | null
}
valignType
enum alignType {
"top" | "bottom" | "middle" | null
}
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
husky
, unist-util-inspect
).github/workflows/main.yaml
actions/checkout v4
actions/setup-node v4
codecov/codecov-action v4
actions/checkout v4
actions/setup-node v4
.github/workflows/semver-check.yaml
package.json
hast-util-to-html 9.0.1
js-yaml 4.1.0
mdast-util-gfm-footnote 2.0.0
mdast-util-gfm-strikethrough 2.0.0
mdast-util-gfm-table 2.0.0
mdast-util-gfm-task-list-item 2.0.0
mdast-util-phrasing 4.1.0
mdast-util-to-hast 13.2.0
micromark-extension-gfm-footnote 2.1.0
micromark-extension-gfm-strikethrough 2.1.0
micromark-extension-gfm-table 2.1.0
micromark-extension-gfm-tagfilter 2.0.0
micromark-extension-gfm-task-list-item 2.1.0
micromark-util-character 2.1.0
micromark-util-combine-extensions 2.0.0
micromark-util-symbol 2.0.0
unist-util-find 3.0.0
unist-util-visit 5.0.0
@adobe/eslint-config-helix 2.0.6
@adobe/remark-gridtables 3.0.6
@semantic-release/changelog 6.0.3
@semantic-release/git 10.0.1
c8 10.1.2
eslint 8.57.0
husky 9.0.11
junit-report-builder 3.2.1
lint-staged 15.2.7
mdast-builder 1.1.1
mocha 10.6.0
mocha-multi-reporters 1.5.1
rehype-format 5.0.0
rehype-stringify 10.0.0
remark-gfm 4.0.0
remark-parse 11.0.0
remark-rehype 11.1.0
remark-stringify 11.0.0
semantic-release 24.0.0
unified 11.0.5
unist-util-inspect 8.0.0
unified 11.x
node >=14
└─1 paragraph[2]
├─0 link[3]
│ │ url: "https://main--healthy-kp--hlxsites.hlx.page/northern-california/health-wellness/cancer-care/"
│ ├─0 text "Cancer Care"
│ ├─1 break "\n"
│ └─2 break "\n"
break
s after link
.breaks
should be converted to spaces, as they can't be represented in markdown.it is important to transport the table cell alignment to markdown, using the following algorithm:
left
top
direction | attribute |
---|---|
left | none (default) |
center | align="center" |
right | align="right" |
justify | align="justify" |
direction | attribute |
---|---|
top | none (default) |
middle | valign="middle" |
bottom | valign="bottom" |
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Failed to decrypt field npmToken. Please re-encrypt and try again.
if an author accidentally puts and image into a heading, it is automatically moved below the heading.
eg:
- heading
- Hello
- <img>
becomes:
# Hello
![](img)
but when the image is the first element it should go above the heading:
- heading
- <img>
- Hello
becomes:
![](img)
# Hello
since the gridtables were moved to https://github.com/adobe/micromark-extension-gridtables their support should be removed here
Description
the sanitizeTextAndFormats
function can cause an endless loop for nested formats.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.