本文整理汇总了TypeScript中json2md.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript json2md.default方法的具体用法?TypeScript json2md.default怎么用?TypeScript json2md.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json2md
的用法示例。
在下文中一共展示了json2md.default方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("Table", () => {
json2md([
{
table: {
headers: EXAMPLE_STRING_ARRAY,
rows: [
{
A: EXAMPLE_STRING,
B: EXAMPLE_STRING
}
]
}
}
]);
json2md([
{
table: {
headers: EXAMPLE_STRING_ARRAY,
rows: [
EXAMPLE_STRING_ARRAY
]
}
}
]);
});
示例2:
it("Custom types", () => {
const customConverter: json2md.ConverterCallback<string> = (input, json2md) => {
return `Hello ${input} world!`;
};
json2md.converters.customConverter = customConverter;
json2md([
{
customConverter: EXAMPLE_STRING
}
]);
});
示例3: sum
it("Big example", () => {
const md: string = json2md([
{
h1: "JSON To Markdown"
},
{
blockquote: "A JSON to Markdown converter."
},
{
img: [
{
title: "Some image",
source: "https://example.com/some-image.png"
},
{
title: "Another image",
source: "https://example.com/some-image1.png"
},
{
title: "Yet another image",
source: "https://example.com/some-image2.png"
}
]
},
{
h2: "Features"
},
{
ul: [
"Easy to use",
"You can programatically generate Markdown content",
"..."
]
},
{
h2: "How to contribute"
},
{
ol: [
"Fork the project",
"Create your branch",
"Raise a pull request"
]
},
{
h2: "Code blocks"
},
{
p: "Below you can see a code block example."
},
{
code: {
language: "js",
content: [
"function sum (a, b) {",
" return a + b;",
"}",
"sum(1, 2);"
]
}
}
]);
});