├── .gitignore ├── .babelrc ├── .flowconfig ├── src ├── ___tests___ │ ├── snapshots │ │ └── test.md │ ├── index.test.js │ └── transformToMarkdownString.test.js ├── index.js ├── writeToFile.js └── transformToMarkdownString.js ├── LICENSE ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "flow"], 3 | } 4 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | 11 | [strict] 12 | -------------------------------------------------------------------------------- /src/___tests___/snapshots/test.md: -------------------------------------------------------------------------------- 1 | --- 2 | key: "content" 3 | anotherKey: ["arrayValue1","arrayValue2"] 4 | anObject: 5 | whatever: "true" 6 | --- 7 | # h1 Heading 8-) 8 | ## h2 Heading 9 | ### h3 Heading 10 | #### h4 Heading 11 | ##### h5 Heading 12 | ###### h6 Heading 13 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | import type { TFrontMatterMarkdown} from './transformToMarkdownString'; 3 | import transformToMarkdownString from './transformToMarkdownString'; 4 | import writeToFile from './writeToFile'; 5 | 6 | type TTransformFrontMatterMarkdown = { frontmatterMarkdown: TFrontMatterMarkdown, path: string, fileName: string }; 7 | 8 | function transformAndWriteToFile({frontmatterMarkdown, path, fileName}: TTransformFrontMatterMarkdown) { 9 | const transformedMarkdown = transformToMarkdownString(frontmatterMarkdown) 10 | return writeToFile({ content: transformedMarkdown, path, fileName}); 11 | } 12 | 13 | export default transformAndWriteToFile 14 | -------------------------------------------------------------------------------- /src/___tests___/index.test.js: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import transformAndWriteToFile from "../index"; 3 | 4 | test("can transformAndWriteToFile", () => { 5 | const smallMarkdownBody = `# h1 Heading 8-) 6 | ## h2 Heading 7 | ### h3 Heading 8 | #### h4 Heading 9 | ##### h5 Heading 10 | ###### h6 Heading 11 | `; 12 | 13 | return transformAndWriteToFile({ 14 | frontmatterMarkdown: { 15 | frontmatter: [ 16 | { key: "content" }, 17 | { anotherKey: ["arrayValue1", "arrayValue2"] }, 18 | { anObject: { whatever: true, wuk: new Error('something') } } 19 | ], 20 | body: smallMarkdownBody 21 | }, 22 | path: path.join(__dirname, "snapshots"), 23 | fileName: "test.md" 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/writeToFile.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | import mkdirp from 'mkdirp'; 3 | import fs from 'fs' 4 | 5 | type TWriteToFile = { 6 | content: string, 7 | path: string, 8 | fileName: string 9 | } 10 | 11 | function createDirectories(path) { 12 | return new Promise((resolve, reject) => 13 | mkdirp(path, (err) => { 14 | if(err) { 15 | console.log(err); 16 | return reject(err); 17 | } 18 | return resolve(); 19 | }) 20 | ) 21 | } 22 | 23 | function writeToFile({ content, path, fileName}: TWriteToFile) { 24 | const doWriteToFile = () => new Promise((resolve, reject) => { 25 | fs.writeFile(`${path}/${fileName}`, content, (err) => { 26 | if(err) { 27 | console.log(err); 28 | return reject(err); 29 | } 30 | console.log(`The file was saved on location: ${path} with name: ${fileName}`); 31 | return resolve(); 32 | }) 33 | }); 34 | 35 | return createDirectories(path) 36 | .then(doWriteToFile); 37 | } 38 | 39 | export default writeToFile 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Easybird (http://easybird.be) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "json-to-frontmatter-markdown", 3 | "version": "1.0.0", 4 | "description": "Transform json to a markdown file with frontmatter and body", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "jest", 8 | "build": "babel src/ -d lib/", 9 | "prepublish": "npm run build", 10 | "flow": "flow" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/easybird/json-to-frontmatter-markdown.git" 15 | }, 16 | "keywords": [ 17 | "json", 18 | "markdown", 19 | "frontmatter", 20 | "node", 21 | "parser", 22 | "md" 23 | ], 24 | "author": "Easybird", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/easybird/json-to-frontmatter-markdown/issues" 28 | }, 29 | "homepage": "https://github.com/easybird/json-to-frontmatter-markdown#readme", 30 | "devDependencies": { 31 | "babel-cli": "^6.26.0", 32 | "babel-core": "^6.26.0", 33 | "babel-jest": "^22.4.3", 34 | "babel-preset-env": "^1.6.1", 35 | "babel-preset-flow": "^6.23.0", 36 | "jest": "^22.4.3", 37 | "regenerator-runtime": "^0.11.1" 38 | }, 39 | "dependencies": { 40 | "left-pad": "^1.3.0", 41 | "mkdirp": "^0.5.1" 42 | }, 43 | "jest": { 44 | "rootDir": "src" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # json-to-frontmatter-markdown 2 | 3 | This library has only one feature: 4 | Transform a javascript object to markdown with frontmatter, and write it to a markdown file on a specified location. 5 | ----- 6 | 7 | The following request, will result in the below markdown file on location /Users/user/path/to/dir/fileName.md: 8 | ```javascript 9 | transformAndWriteToFile({ 10 | frontmatterMarkdown: { 11 | frontMatter: [ 12 | { var1: 'this is a string'}, 13 | { var2: ['this is an array', 'element2']}, 14 | { obj1: { 15 | var3: "var3" 16 | }} 17 | ], 18 | body: ` 19 | # h1 Heading 8-) 20 | ## h2 Heading 21 | ### h3 Heading 22 | #### h4 Heading 23 | ##### h5 Heading 24 | ###### h6 Heading 25 | ` 26 | }, 27 | path: '/Users/user/path/to/dir', 28 | fileName: 'fileName.md' 29 | }) 30 | ``` 31 | 32 | Result: 33 | ```markdown 34 | --- 35 | var1: "this is a string" 36 | var2: ["this is an array","element2"] 37 | obj1: 38 | var3: "var3" 39 | --- 40 | # h1 Heading 8-) 41 | ## h2 Heading 42 | ### h3 Heading 43 | #### h4 Heading 44 | ##### h5 Heading 45 | ###### h6 Heading 46 | ``` 47 | 48 | ---- 49 | If you have a feature request or issues, don't hesitate to log an issue.🙏 50 | -------------------------------------------------------------------------------- /src/transformToMarkdownString.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | import leftPad from "left-pad"; 3 | 4 | type TFrontMatter = { 5 | [string]: string | Array 6 | }; 7 | 8 | export type TFrontMatterMarkdown = { 9 | frontmatter: Array, 10 | body: string 11 | }; 12 | 13 | function newLineAndIndent(markdownString, depth) { 14 | if (depth === 0) { 15 | return `${markdownString}\n`; 16 | } 17 | 18 | return `${markdownString}\n${leftPad('', depth*2)}`; 19 | } 20 | 21 | function transformMarkdownKeyValueToString( 22 | key, 23 | value, 24 | markdownString, 25 | depth = 0 26 | ) { 27 | try { 28 | if (typeof value === "object") { 29 | if (value instanceof Array) { 30 | const arrayString = `${value.map(item => `"${item}"`)}`; 31 | return `${newLineAndIndent( 32 | markdownString, 33 | depth 34 | )}${key}: [${arrayString}]`; 35 | } else if (value instanceof Error) { 36 | return markdownString; 37 | } else { 38 | return Object.entries(value).reduce( 39 | (accString, [entryKey, entryValue]) => { 40 | return `${transformMarkdownKeyValueToString( 41 | entryKey, 42 | entryValue, 43 | accString, 44 | depth + 1 45 | )}`; 46 | }, 47 | `${newLineAndIndent(markdownString, depth)}${key}:` 48 | ); 49 | } 50 | } else { 51 | return `${newLineAndIndent(markdownString, depth)}${key}: "${value}"`; 52 | } 53 | } catch (err) { 54 | return `${newLineAndIndent(markdownString, depth)}${key}: ${JSON.stringify( 55 | value 56 | )}`; 57 | } 58 | } 59 | 60 | function transformToMarkdownString(frontmatterMarkdown: TFrontMatterMarkdown) { 61 | let markdownString = `---`; 62 | frontmatterMarkdown.frontmatter.forEach(frontmatterField => 63 | Object.entries(frontmatterField).forEach(([key, value]) => { 64 | markdownString = transformMarkdownKeyValueToString( 65 | key, 66 | value, 67 | markdownString 68 | ); 69 | }) 70 | ); 71 | 72 | markdownString = `${markdownString}\n---`; 73 | try { 74 | markdownString = `${markdownString}\n${frontmatterMarkdown.body}`; 75 | } catch (e) { 76 | markdownString = `${markdownString}\n${JSON.stringify( 77 | frontmatterMarkdown.body 78 | )}`; 79 | } 80 | // TODO implement the transform 81 | return markdownString; 82 | } 83 | 84 | export default transformToMarkdownString; 85 | -------------------------------------------------------------------------------- /src/___tests___/transformToMarkdownString.test.js: -------------------------------------------------------------------------------- 1 | import transformToMarkdownString from "../transformToMarkdownString"; 2 | 3 | test("can create a string with markdown", () => { 4 | const smallMarkdownBody = `# h1 Heading 8-) 5 | ## h2 Heading 6 | ### h3 Heading 7 | #### h4 Heading 8 | ##### h5 Heading 9 | ###### h6 Heading`; 10 | 11 | const markdownString = transformToMarkdownString({ 12 | frontmatter: [{ key: "content" }, { anotherKey: "otherContent" }], 13 | body: smallMarkdownBody 14 | }); 15 | expect(markdownString).toBe(`--- 16 | key: "content" 17 | anotherKey: "otherContent" 18 | --- 19 | # h1 Heading 8-) 20 | ## h2 Heading 21 | ### h3 Heading 22 | #### h4 Heading 23 | ##### h5 Heading 24 | ###### h6 Heading`); 25 | }); 26 | 27 | test("can create a string with markdown and bodyWithBackticks included", () => { 28 | const bodyWithBackticks = `# h1 Heading 8-) 29 | ## h2 Heading 30 | ### h3 Heading 31 | #### h4 Heading 32 | ##### h5 Heading 33 | ###### h6 Heading 34 | 35 | 36 | ## Horizontal Rules 37 | 38 | ___ 39 | 40 | --- 41 | 42 | *** 43 | 44 | 45 | ## Typographic replacements 46 | 47 | Enable typographer option to see result. 48 | 49 | (c) (C) (r) (R) (tm) (TM) (p) (P) +- 50 | 51 | test.. test... test..... test?..... test!.... 52 | 53 | !!!!!! ???? ,, -- --- 54 | 55 | "Smartypants, double quotes" and 'single quotes' 56 | 57 | 58 | ## Emphasis 59 | 60 | **This is bold text** 61 | 62 | __This is bold text__ 63 | 64 | *This is italic text* 65 | 66 | _This is italic text_ 67 | 68 | ~~Strikethrough~~ 69 | 70 | 71 | ## Blockquotes 72 | 73 | 74 | > Blockquotes can also be nested... 75 | >> ...by using additional greater-than signs right next to each other... 76 | > > > ...or with spaces between arrows. 77 | 78 | 79 | ## Lists 80 | 81 | Unordered 82 | 83 | + Create a list by starting a line with \`+\`, \`-\`, or \`*\` 84 | + Sub-lists are made by indenting 2 spaces: 85 | - Marker character change forces new list start: 86 | * Ac tristique libero volutpat at 87 | + Facilisis in pretium nisl aliquet 88 | - Nulla volutpat aliquam velit 89 | + Very easy! 90 | 91 | Ordered 92 | 93 | 1. Lorem ipsum dolor sit amet 94 | 2. Consectetur adipiscing elit 95 | 3. Integer molestie lorem at massa 96 | 97 | 98 | 1. You can use sequential numbers... 99 | 1. ...or keep all the numbers as \`1.\` 100 | 101 | Start numbering with offset: 102 | 103 | 57. foo 104 | 1. bar 105 | 106 | 107 | ## Code 108 | 109 | Inline \`code\` 110 | 111 | Indented code 112 | 113 | // Some comments 114 | line 1 of code 115 | line 2 of code 116 | line 3 of code 117 | 118 | 119 | Block code "fences" 120 | 121 | \`\`\` 122 | Sample text here... 123 | \`\`\` 124 | 125 | Syntax highlighting 126 | 127 | \`\`\` js 128 | var foo = function (bar) { 129 | return bar++; 130 | }; 131 | 132 | console.log(foo(5)); 133 | \`\`\` 134 | 135 | ## Tables 136 | 137 | | Option | Description | 138 | | ------ | ----------- | 139 | | data | path to data files to supply the data that will be passed into templates. | 140 | | engine | engine to be used for processing templates. Handlebars is the default. | 141 | | ext | extension to be used for dest files. | 142 | 143 | Right aligned columns 144 | 145 | | Option | Description | 146 | | ------:| -----------:| 147 | | data | path to data files to supply the data that will be passed into templates. | 148 | | engine | engine to be used for processing templates. Handlebars is the default. | 149 | | ext | extension to be used for dest files. | 150 | 151 | 152 | ## Links 153 | 154 | [link text](http://dev.nodeca.com) 155 | 156 | [link with title](http://nodeca.github.io/pica/demo/ "title text!") 157 | 158 | Autoconverted link https://github.com/nodeca/pica (enable linkify to see) 159 | 160 | 161 | ## Images 162 | 163 | ![Minion](https://octodex.github.com/images/minion.png) 164 | ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") 165 | 166 | Like links, Images also have a footnote style syntax 167 | 168 | ![Alt text][id] 169 | 170 | With a reference later in the document defining the URL location: 171 | 172 | [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" 173 | 174 | 175 | ## Plugins 176 | 177 | The killer feature of \`markdown-it\` is very effective support of 178 | [syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin). 179 | 180 | 181 | ### [Emojies](https://github.com/markdown-it/markdown-it-emoji) 182 | 183 | > Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum: 184 | > 185 | > Shortcuts (emoticons): :-) :-( 8-) ;) 186 | 187 | see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji. 188 | 189 | 190 | ### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup) 191 | 192 | - 19^th^ 193 | - H~2~O 194 | 195 | 196 | ### [\](https://github.com/markdown-it/markdown-it-ins) 197 | 198 | ++Inserted text++ 199 | 200 | 201 | ### [\](https://github.com/markdown-it/markdown-it-mark) 202 | 203 | ==Marked text== 204 | 205 | 206 | ### [Footnotes](https://github.com/markdown-it/markdown-it-footnote) 207 | 208 | Footnote 1 link[^first]. 209 | 210 | Footnote 2 link[^second]. 211 | 212 | Inline footnote^[Text of inline footnote] definition. 213 | 214 | Duplicated footnote reference[^second]. 215 | 216 | [^first]: Footnote **can have markup** 217 | 218 | and multiple paragraphs. 219 | 220 | [^second]: Footnote text. 221 | 222 | 223 | ### [Definition lists](https://github.com/markdown-it/markdown-it-deflist) 224 | 225 | Term 1 226 | 227 | : Definition 1 228 | with lazy continuation. 229 | 230 | Term 2 with *inline markup* 231 | 232 | : Definition 2 233 | 234 | { some code, part of Definition 2 } 235 | 236 | Third paragraph of definition 2. 237 | 238 | _Compact style:_ 239 | 240 | Term 1 241 | ~ Definition 1 242 | 243 | Term 2 244 | ~ Definition 2a 245 | ~ Definition 2b 246 | 247 | 248 | ### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr) 249 | 250 | This is HTML abbreviation example. 251 | 252 | It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. 253 | 254 | *[HTML]: Hyper Text Markup Language 255 | 256 | ### [Custom containers](https://github.com/markdown-it/markdown-it-container) 257 | 258 | ::: warning 259 | *here be dragons* 260 | :::`; 261 | 262 | const markdownString = transformToMarkdownString({ 263 | frontmatter: [{ key: "content" }, { anotherKey: ["whatever", "otherContent"] }], 264 | body: bodyWithBackticks 265 | }); 266 | const expectedResult = `--- 267 | key: "content" 268 | anotherKey: ["whatever","otherContent"] 269 | --- 270 | # h1 Heading 8-) 271 | ## h2 Heading 272 | ### h3 Heading 273 | #### h4 Heading 274 | ##### h5 Heading 275 | ###### h6 Heading 276 | 277 | 278 | ## Horizontal Rules 279 | 280 | ___ 281 | 282 | --- 283 | 284 | *** 285 | 286 | 287 | ## Typographic replacements 288 | 289 | Enable typographer option to see result. 290 | 291 | (c) (C) (r) (R) (tm) (TM) (p) (P) +- 292 | 293 | test.. test... test..... test?..... test!.... 294 | 295 | !!!!!! ???? ,, -- --- 296 | 297 | "Smartypants, double quotes" and 'single quotes' 298 | 299 | 300 | ## Emphasis 301 | 302 | **This is bold text** 303 | 304 | __This is bold text__ 305 | 306 | *This is italic text* 307 | 308 | _This is italic text_ 309 | 310 | ~~Strikethrough~~ 311 | 312 | 313 | ## Blockquotes 314 | 315 | 316 | > Blockquotes can also be nested... 317 | >> ...by using additional greater-than signs right next to each other... 318 | > > > ...or with spaces between arrows. 319 | 320 | 321 | ## Lists 322 | 323 | Unordered 324 | 325 | + Create a list by starting a line with \`+\`, \`-\`, or \`*\` 326 | + Sub-lists are made by indenting 2 spaces: 327 | - Marker character change forces new list start: 328 | * Ac tristique libero volutpat at 329 | + Facilisis in pretium nisl aliquet 330 | - Nulla volutpat aliquam velit 331 | + Very easy! 332 | 333 | Ordered 334 | 335 | 1. Lorem ipsum dolor sit amet 336 | 2. Consectetur adipiscing elit 337 | 3. Integer molestie lorem at massa 338 | 339 | 340 | 1. You can use sequential numbers... 341 | 1. ...or keep all the numbers as \`1.\` 342 | 343 | Start numbering with offset: 344 | 345 | 57. foo 346 | 1. bar 347 | 348 | 349 | ## Code 350 | 351 | Inline \`code\` 352 | 353 | Indented code 354 | 355 | // Some comments 356 | line 1 of code 357 | line 2 of code 358 | line 3 of code 359 | 360 | 361 | Block code "fences" 362 | 363 | \`\`\` 364 | Sample text here... 365 | \`\`\` 366 | 367 | Syntax highlighting 368 | 369 | \`\`\` js 370 | var foo = function (bar) { 371 | return bar++; 372 | }; 373 | 374 | console.log(foo(5)); 375 | \`\`\` 376 | 377 | ## Tables 378 | 379 | | Option | Description | 380 | | ------ | ----------- | 381 | | data | path to data files to supply the data that will be passed into templates. | 382 | | engine | engine to be used for processing templates. Handlebars is the default. | 383 | | ext | extension to be used for dest files. | 384 | 385 | Right aligned columns 386 | 387 | | Option | Description | 388 | | ------:| -----------:| 389 | | data | path to data files to supply the data that will be passed into templates. | 390 | | engine | engine to be used for processing templates. Handlebars is the default. | 391 | | ext | extension to be used for dest files. | 392 | 393 | 394 | ## Links 395 | 396 | [link text](http://dev.nodeca.com) 397 | 398 | [link with title](http://nodeca.github.io/pica/demo/ "title text!") 399 | 400 | Autoconverted link https://github.com/nodeca/pica (enable linkify to see) 401 | 402 | 403 | ## Images 404 | 405 | ![Minion](https://octodex.github.com/images/minion.png) 406 | ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") 407 | 408 | Like links, Images also have a footnote style syntax 409 | 410 | ![Alt text][id] 411 | 412 | With a reference later in the document defining the URL location: 413 | 414 | [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" 415 | 416 | 417 | ## Plugins 418 | 419 | The killer feature of \`markdown-it\` is very effective support of 420 | [syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin). 421 | 422 | 423 | ### [Emojies](https://github.com/markdown-it/markdown-it-emoji) 424 | 425 | > Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum: 426 | > 427 | > Shortcuts (emoticons): :-) :-( 8-) ;) 428 | 429 | see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji. 430 | 431 | 432 | ### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup) 433 | 434 | - 19^th^ 435 | - H~2~O 436 | 437 | 438 | ### [\](https://github.com/markdown-it/markdown-it-ins) 439 | 440 | ++Inserted text++ 441 | 442 | 443 | ### [\](https://github.com/markdown-it/markdown-it-mark) 444 | 445 | ==Marked text== 446 | 447 | 448 | ### [Footnotes](https://github.com/markdown-it/markdown-it-footnote) 449 | 450 | Footnote 1 link[^first]. 451 | 452 | Footnote 2 link[^second]. 453 | 454 | Inline footnote^[Text of inline footnote] definition. 455 | 456 | Duplicated footnote reference[^second]. 457 | 458 | [^first]: Footnote **can have markup** 459 | 460 | and multiple paragraphs. 461 | 462 | [^second]: Footnote text. 463 | 464 | 465 | ### [Definition lists](https://github.com/markdown-it/markdown-it-deflist) 466 | 467 | Term 1 468 | 469 | : Definition 1 470 | with lazy continuation. 471 | 472 | Term 2 with *inline markup* 473 | 474 | : Definition 2 475 | 476 | { some code, part of Definition 2 } 477 | 478 | Third paragraph of definition 2. 479 | 480 | _Compact style:_ 481 | 482 | Term 1 483 | ~ Definition 1 484 | 485 | Term 2 486 | ~ Definition 2a 487 | ~ Definition 2b 488 | 489 | 490 | ### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr) 491 | 492 | This is HTML abbreviation example. 493 | 494 | It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. 495 | 496 | *[HTML]: Hyper Text Markup Language 497 | 498 | ### [Custom containers](https://github.com/markdown-it/markdown-it-container) 499 | 500 | ::: warning 501 | *here be dragons* 502 | :::` 503 | 504 | expect(markdownString).toBe(expectedResult); 505 | }); 506 | --------------------------------------------------------------------------------