{"id":13534575,"url":"https://github.com/albinotonnina/mmarkdown","last_synced_at":"2025-06-27T16:32:08.579Z","repository":{"id":53418068,"uuid":"130480474","full_name":"albinotonnina/mmarkdown","owner":"albinotonnina","description":"Interpret mmd fenced code blocks in a markdown file and generate a cooler version of it.","archived":false,"fork":false,"pushed_at":"2021-03-30T21:19:23.000Z","size":36,"stargazers_count":77,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-22T09:28:11.103Z","etag":null,"topics":["generator","javascript","markdown"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albinotonnina.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-21T14:18:37.000Z","updated_at":"2025-01-06T06:45:18.000Z","dependencies_parsed_at":"2022-08-27T16:11:56.920Z","dependency_job_id":null,"html_url":"https://github.com/albinotonnina/mmarkdown","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/albinotonnina/mmarkdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinotonnina%2Fmmarkdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinotonnina%2Fmmarkdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinotonnina%2Fmmarkdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinotonnina%2Fmmarkdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albinotonnina","download_url":"https://codeload.github.com/albinotonnina/mmarkdown/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinotonnina%2Fmmarkdown/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261616202,"owners_count":23184970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","javascript","markdown"],"created_at":"2024-08-01T08:00:28.127Z","updated_at":"2025-06-27T16:32:08.556Z","avatar_url":"https://github.com/albinotonnina.png","language":"JavaScript","funding_links":[],"categories":["The list","Libraries","Convert to Markdown Tools"],"sub_categories":["JavaScript","Source Code to Markdown"],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://img.ziggi.org/BY9iI48Q.png\" /\u003e\u003c/p\u003e\n\n# mmarkdown\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/05044458973941749858f50e71effe25)](https://app.codacy.com/app/albinotonnina/mmarkdown?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=albinotonnina/mmarkdown\u0026utm_campaign=badger)\n\n\u003e Markdown on caffeine ☕️\n\nInterpret `mmd` fenced code blocks in a markdown file and generate a cooler version of it.\n\n### `mmd` fenced code block\n\n\u003cimg src=\"https://img.ziggi.org/gmo0SjMD.png\" /\u003e\n\n### output:\n\n#### Hello Jessie\n\n## Table of Contents\n\n* [Demo](#demo--boilerplate--real-world-case)\n* [Install](#install)\n* [Usage](#usage)\n* [Maintainers](#maintainers)\n* [Contribute](#contribute)\n* [License](#license)\n\n## Demo / Boilerplate / Real world case\n\nThe file you are reading right now is generated from [this file](./ReadmeSrc/Readme.md).\n\nFor a kind of boilerplate repo instead, have a look at [this repo](https://github.com/albinotonnina/mmarkdown-demo).\n\n🌎[MicheleBertoli/css-in-js](https://github.com/MicheleBertoli/css-in-js)\n\n🌎[streamich/cross-ci](https://github.com/streamich/cross-ci)\n\n## Install\n\n```\nyarn add mmarkdown --dev\n```\n\n### Config package.json (defaults)\n\n```\n{\n    \"mmarkdown\": {\n      \"src\": \"./Readme/Readme.md\",\n      \"out\": \"./Readme.md\",\n      \"scripts\": \"./Readme/Readme.js\",\n      \"backup\": \"true\",\n      \"backupPath\": \"./Readme/backup/\"\n    }\n}\n```\n\n```\n{\n  \"scripts\":{\n    \"make-readme\": \"mmarkdown\"\n  }\n}\n```\n\n### Command line arguments\n\n| argument   | description                    | default               |\n| ---------- | ------------------------------ | --------------------- |\n| src        | Source md file                 | ./ReadmeSrc/Readme.md |\n| out        | Output md file                 | ./Readme.md           |\n| scripts    | Helper JS file                 | ./ReadmeSrc/Readme.js |\n| backup     | Do a backup of the output file | false                 |\n| backupPath | backup path                    | ./ReadmeSrc/backup/   |\n| help       | Show help                      |                       |\n| version    | Show version number            |                       |\n\n```\n{\n  \"scripts\":{\n    \"make-readme\": \"mmarkdown --backup --backupPath ./backupReadme/\"\n  }\n}\n```\n\n## Usage\n\nMmarkdown takes a plain markdown file and generates a copy of it.\n\nIt starts to be less boring when you add [fenced code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) with the language identifier set to `mmd`.\n\nEverything that is returned (as a string) from the code in a block will be interpreted and replaced to the block in the output file.\n\nIt's full async, which is cool, _lots of `awaits` are waiting for you_ there but soon enough you will face a problem: too much code to write in a markdown file! Terrible experience!\n\nThe solution in mmarkdown is in the `scripts` option. The module that the scripts file returns will be passed to the context of the fenced block, see [example 3](#example3).\n\nThe `backup` option, false by default, will make a copy of the current output file, postfix it with a timestamp and move it into `backupPath`.\n\n### Example 1\n\n#### `mmd` fenced code block:\n\n```javascript\nconst hello = message =\u003e {\n  return message\n}\n\nreturn hello('### hippieeeeee hippie yeeeee!!!!!!!!')\n```\n\n#### output:\n\n### hippieeeeee hippie yeeeee!!!!!!!!\n\n### Example 2\n\n#### `mmd` fenced code block:\n\n```javascript\nconst array = [1, 3, 5]\n\nreturn array.map(item =\u003e '#### ' + item).join('\\n\\n')\n```\n\n#### output:\n\n#### 1\n\n#### 3\n\n#### 5\n\n### Example 3, with Scripts\n\n[this script file ](./ReadmeSrc/Readme.js) is passed to mmarkdown with the `scripts` option:\n\n```javascript\nmodule.exports = {\n  processMyArray: async array =\u003e\n    new Promise(resolve =\u003e {\n      setTimeout(() =\u003e {\n        resolve(\n          array.map(item =\u003e ({\n            name: item + ' async'\n          }))\n        )\n      }, 1000)\n    })\n}\n```\n\n#### mmd fenced code block:\n\n```javascript\n//scripts is passed\n\nconst array = [1, 3, 5]\n\nconst something = await scripts.processMyArray(array)\n\nconst myFinalString = something.map(item =\u003e '#### ' + item.name)\n  .join('\\n\\n')\n\nreturn myFinalString\n```\n\n#### output:\n\n#### 1 async\n\n#### 3 async\n\n#### 5 async\n\n(The setTimeout is there just for demo purposes)\n\n\n\n## Maintainers\n\n[@albinotonnina](https://github.com/albinotonnina)\n\n## Contribute\n\nPRs accepted.\n\n## License\n\nMIT © 2018 Albino Tonnina\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinotonnina%2Fmmarkdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbinotonnina%2Fmmarkdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinotonnina%2Fmmarkdown/lists"}