Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cenfun/markdown-grid
Markdown Grid Generator
https://github.com/cenfun/markdown-grid
generator grid markdown
Last synced: about 1 month ago
JSON representation
Markdown Grid Generator
- Host: GitHub
- URL: https://github.com/cenfun/markdown-grid
- Owner: cenfun
- License: mit
- Created: 2022-08-15T03:39:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-30T02:51:07.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T07:39:01.199Z (about 1 month ago)
- Topics: generator, grid, markdown
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/markdown-grid
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# markdown-grid
> Markdown Grid Generator## Install
```sh
npm i markdown-grid
```
## UsageData Format Definition: [CGDF](https://github.com/cenfun/cgdf)
```js
const MG = require("markdown-grid");
const mg = MG({
"columns": ["", "Name", "Value"],
"rows": [
[1, "Tom", "Value 1"],
[2, "Jerry", "Value 2"]
]
});console.log(mg);
| |Name|Value|
|---|----|-----|
|1 |Tom |Value 1|
|2 |Jerry|Value 2|
```
| |Name|Value|
|---|----|-----|
|1 |Tom |Value 1|
|2 |Jerry|Value 2|
## With column width:
```js
const MG = require("markdown-grid");
const mg = MG({
"columns": ["", {
"name": "Name",
"width": 15
}, {
"name": "Value",
"width": 35
}],
"rows": [
[1, "Hello", "Long Text Value"],
[2, "Hello There", "Long Text Value Long Text Value"]
]
});console.log(mg);
| |Name |Value |
|---|---------------|-----------------------------------|
|1 |Hello |Long Text Value |
|2 |Hello There |Long Text Value Long Text Value |
```
| |Name |Value |
|---|---------------|-----------------------------------|
|1 |Hello |Long Text Value |
|2 |Hello There |Long Text Value Long Text Value |
## With column align and padding:
```js
const MG = require("markdown-grid");
const mg = MG({
"options": {
"padding": 1
},
"columns": [{
"id": "default",
"name": "Default",
"width": 10
}, {
"id": "left",
"name": "Left",
"width": 10,
"align": "left"
}, {
"id": "center",
"name": "Center",
"width": 10,
"align": "center"
}, {
"id": "right",
"name": "Right",
"width": 10,
"align": "right"
}],
"rows": [{
"default": "Cell",
"left": "Markdown",
"center": "Start",
"right": "123.0"
}, {
"default": "Content",
"left": "Grid",
"center": "Complete",
"right": "8.1"
}]
});console.log(mg);
| Default | Left | Center | Right |
| ---------- | :--------- | :--------: | ---------: |
| Cell | Markdown | Start | 123.0 |
| Content | Grid | Complete | 8.1 |
```
| Default | Left | Center | Right |
| ---------- | :--------- | :--------: | ---------: |
| Cell | Markdown | Start | 123.0 |
| Content | Grid | Complete | 8.1 |
## With special character:
```js
const MG = require("markdown-grid");
const mg = MG({
"columns": [{
"name": "Name",
"width": 15
}, {
"name": "Character",
"align": "center"
}],
"rows": [
["Backtick", "`"],
["Pipe", "|"],
["Escaped Pipes", "\\||\\|"],
["中文", "✅"]
]
});console.log(mg);
|Name |Character|
|---------------|:-------:|
|Backtick | ` |
|Pipe | \| |
|Escaped Pipes | \|\|\| |
|中文 | ✅ |
```
|Name |Character|
|---------------|:-------:|
|Backtick | ` |
|Pipe | \| |
|Escaped Pipes | \|\|\| |
|中文 | ✅ |
## With links, images, Codes and formatting:
```js
const MG = require("markdown-grid");
const mg = MG({
"columns": ["Name", "Version", "Install", "Description"],
"rows": [
["[markdown-grid](https://github.com/cenfun/markdown-grid)", "![npm](https://badgen.net/npm/v/markdown-grid)", "`npm i markdown-grid`", "Generating a **Markdown** *Grid*"],
["[console-grid](https://github.com/cenfun/console-grid)", "![npm](https://badgen.net/npm/v/console-grid)", "`npm i console-grid`", "Log a *Grid* in **Console**"]
]
});console.log(mg);
|Name|Version|Install|Description|
|----|-------|-------|-----------|
|[markdown-grid](https://github.com/cenfun/markdown-grid)|![npm](https://badgen.net/npm/v/markdown-grid)|`npm i markdown-grid`|Generating a **Markdown** *Grid*|
|[console-grid](https://github.com/cenfun/console-grid)|![npm](https://badgen.net/npm/v/console-grid)|`npm i console-grid`|Log a *Grid* in **Console**|
```
|Name|Version|Install|Description|
|----|-------|-------|-----------|
|[markdown-grid](https://github.com/cenfun/markdown-grid)|![npm](https://badgen.net/npm/v/markdown-grid)|`npm i markdown-grid`|Generating a **Markdown** *Grid*|
|[console-grid](https://github.com/cenfun/console-grid)|![npm](https://badgen.net/npm/v/console-grid)|`npm i console-grid`|Log a *Grid* in **Console**|