Easily to convert JSON data to Markdown Table

markdowntable - JSON 转 Markdown 表格的工具

目录

[TOC]

1. 使用方法

./markdowntable [-in jsonFilePath] [-out markdownFilePath]

选项:
  in: 输入JSON 文件,默认 "./info.json"
  out: 输出 markdown 文件,默认 "./info.md"

支持 MacOS, Linux 和 Windows 平台

2. 如何设置字段的内容?

2.1 以字符串结尾

如果一个字段的值不再包含子元素,值是 字符串,那么字符串就是字段的内容,插入到表格最后一列

2.2 以特定结构结尾

特定结构指:

{
    "header": "标题 - 这是一个标题",
    "desc": "描述 - 这是一个描述内容",
    "defaultValue": "默认值:Hello world",
    "options": [
        "字段接受的值1 - Hello world",
        "字段接受的值2 - 你好世界"
    ]
}

如果一个字段的值是以上的特定结构,那么该特定结构就是字段的内容,插入到表格最后一列。

说明:

"header" - 必须包含该字段
"desc" - 必须包含该字段
"defaultValue" - 可选字段
"options" - 可选字段, 支持数组

# 注:不支持自定义字段

3. 例子

以以下JSON 为例

{
    "1_1": {
        "1_2": {
            "1_3": {
                "header": "标题 - 第 1 行 第 4 列",
                "desc": "描述 - 这是一个描述内容",
                "defaultValue": "Hello world",
                "options": [
                    "Hello world",
                    "你好世界"
                ]
            },
            "2_3": {
                "2_4": "第 2 行 第 5 列",
                "3_4": "第 3 行 第 5 列"
            }
        },
        "4_2": {
            "4_3": {
                "4_4": "第 4 行 第 5 列",
                "5_4": "第 5 行 第 5 列"
            },
            "6_3": "第 6 行 第 4 列",
            "7_3": {
                "7_4": "第 7 行 第 5 列",
                "8_4": {
                    "header": "标题 - 第 8 行 第 5 列",
                    "desc": "描述 - 这是一个描述内容",
                    "defaultValue": "Hello world",
                    "options": [
                        "Hello world",
                        "你好世界"
                    ]
                }
            }
        }
    },
    "9_1": "第 9 行 第 2 列",
    "a0_1": {
        "a0_2": {
            "a0_3": {
                "a0_4": "第 10 行 第 5 列"
            }
        }
    },
    "a1_1": {
        "a1_2": "第 11 行 第 3 列"
    }
}

它将转换成 表格

参数 子参 子参 子参 释义
1_1 1_2 1_3 标题 - 第 1 行 第 4 列
描述 - 这是一个描述内容
默认:Hello world
可能的值:
  • Hello world
  • 你好世界
2_3 2_4 第 2 行 第 5 列
3_4 第 3 行 第 5 列
4_2 4_3 4_4 第 4 行 第 5 列
5_4 第 5 行 第 5 列
6_3 第 6 行 第 4 列
7_3 7_4 第 7 行 第 5 列
8_4 标题 - 第 8 行 第 5 列
描述 - 这是一个描述内容
默认:Hello world
可能的值:
  • Hello world
  • 你好世界
9_1 第 9 行 第 2 列
a0_1 a0_2 a0_3 a0_4 第 10 行 第 5 列
a1_1 a1_2 第 11 行 第 3 列
Similar Resources

Upskirt markdown library bindings for Go

Goskirt Package goskirt provides Go-bindings for the excellent Sundown Markdown parser. (F/K/A Upskirt). To use goskirt, create a new Goskirt-value wi

Oct 23, 2022

A CLI markdown converter written in Go.

MDConv is a markdown converter written in Go. It is able to create PDF and HTML files from Markdown without using LaTeX. Instead MDConv u

Dec 20, 2022

A markdown renderer package for the terminal

A markdown renderer package for the terminal

go-term-markdown go-term-markdown is a go package implementing a Markdown renderer for the terminal. Note: Markdown being originally designed to rende

Nov 25, 2022

A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.

goldmark A Markdown parser written in Go. Easy to extend, standards-compliant, well-structured. goldmark is compliant with CommonMark 0.29. Motivation

Dec 29, 2022

:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.

:triangular_ruler:gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt.

gofmtmd gofmtmd formats go source code block in Markdown. detects fenced code & formats code using gofmt. Installation $ go get github.com/po3rin/gofm

Oct 31, 2022

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Glamour Write handsome command-line tools with Glamour. glamour lets you render markdown documents & templates on ANSI compatible terminals. You can c

Jan 1, 2023

go-md2man - 转换 Markdown 为 man 手册内容

go-md2man Converts markdown into roff (man pages). Uses blackfriday to process markdown into man pages. Usage ./md2man -in /path/to/markdownfile.md -o

Dec 22, 2022

A PDF renderer for the goldmark markdown parser.

A PDF renderer for the goldmark markdown parser.

goldmark-pdf goldmark-pdf is a renderer for goldmark that allows rendering to PDF. Reference See https://pkg.go.dev/github.com/stephenafamo/goldmark-p

Jan 7, 2023

Markdown to Webpage app

mark2web Markdown to webpage link Usage $ mark2web test.md https://mark2web.test/aa32d8f230ef9d44c3a7acb55b572c8599502701 $ mark2web /tmp/session/test

Apr 18, 2021
Markdown - Markdown converter for golang

markdown ?? Talks ?? Join ?? Youtube ❤️ Sponsor Install via nami nami install ma

Jun 2, 2022
Mdfmt - A Markdown formatter that follow the CommonMark. Like gofmt, but for Markdown

Introduction A Markdown formatter that follow the CommonMark. Like gofmt, but fo

Dec 18, 2022
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Jan 6, 2023
Convert Microsoft Word Document to Markdown
Convert Microsoft Word Document to Markdown

docx2md Convert Microsoft Word Document to Markdown Usage $ docx2md NewDocument.docx Installation $ go get github.com/mattn/docx2md Supported Styles

Jan 4, 2023
Convert your markdown files to PDF instantly
Convert your markdown files to PDF instantly

Will take a markdown file as input and then create a PDF file with the markdown formatting.

Nov 7, 2022
Convert xml and json to go struct

xj2go The goal is to convert xml or json file to go struct file. Usage Download and install it: $ go get -u -v github.com/wk30/xj2go/cmd/... $ xj [-t

Oct 23, 2022
Parse data and test fixtures from markdown files, and patch them programmatically, too.

go-testmark Do you need test fixtures and example data for your project, in a language agnostic way? Do you want it to be easy to combine with documen

Oct 31, 2022
Gotabulate - Easily pretty-print your tabular data with Go

Gotabulate - Easily pretty-print tabular data Summary Go-Tabulate - Generic Go Library for easy pretty-printing of tabular data. Installation go get g

Dec 27, 2022
Blackfriday: a markdown processor for Go

Blackfriday Blackfriday is a Markdown processor implemented in Go. It is paranoid about its input (so you can safely feed it user-supplied data), it i

Jan 8, 2023
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

Dec 19, 2022