{"id":17446014,"url":"https://github.com/jamen/markdown-to-code","last_synced_at":"2025-04-02T10:43:14.089Z","repository":{"id":96784918,"uuid":"187192159","full_name":"jamen/markdown-to-code","owner":"jamen","description":null,"archived":false,"fork":false,"pushed_at":"2019-05-17T09:55:35.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T01:49:13.280Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamen.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-17T09:55:22.000Z","updated_at":"2021-12-19T15:26:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"c67397c2-2677-4105-8200-19fd7797ea8e","html_url":"https://github.com/jamen/markdown-to-code","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fmarkdown-to-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fmarkdown-to-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fmarkdown-to-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fmarkdown-to-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/markdown-to-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246802594,"owners_count":20836365,"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":[],"created_at":"2024-10-17T18:20:34.086Z","updated_at":"2025-04-02T10:43:14.068Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @jamen/markdown-to-code\n\nA [literate programming][1] tool using markdown and codeblocks.  It turns codeblocks into source code and the rest of the content into comments, allowing you to execute or analyze only the code.\n\n## Install\n\n```\nnpm i @jamen/markdown-to-code\n```\n\nOr quickly use command-line utility:\n\n```sh\nnpx @jamen/markdown-to-code foo.md foo.js\n```\n\n## Usage\n\n### `markdownCode(options?)`\n\nCompiles an `input` stream with the given options, returns a readable stream.\n\n```js\nlet compileMarkdown = markdownCode({\n    language: 'js',\n    mode: {\n        opener: '/**',\n        normal: ' * ',\n        closer: ' **/'\n    }\n})\n\ncreateReadStream('input.md')\n.pipe(compileMarkdown)\n.pipe(createWriteStream('output.js'))\n```\n\n### `markdown-to-code \u003cinput\u003e \u003coutput\u003e`\n\nCommand-line tool that compiles the input file to the output file. Uses stdio without files.\n\nUse `--mode` or `-m` to set the commenting mode (see [lib/modes.json](lib/modes.json)).\n\nTo opt-in or opt-out of codeblocks turning into code, you use HTML comments above them containing the word \"export\".  By default this is an opt-in behavior, but you can use the `--all` or `-a` flag to make it opt-out (everything is exported)\n\n[1]: https://en.wikipedia.org/wiki/Literate_programming","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fmarkdown-to-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fmarkdown-to-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fmarkdown-to-code/lists"}