{"id":23241079,"url":"https://github.com/labbsr0x/js-to-markdown","last_synced_at":"2025-07-08T00:13:08.373Z","repository":{"id":39486840,"uuid":"273368667","full_name":"labbsr0x/js-to-markdown","owner":"labbsr0x","description":"Generate code documentation with markdown automatically from js files!","archived":false,"fork":false,"pushed_at":"2023-01-06T09:49:14.000Z","size":9863,"stargazers_count":8,"open_issues_count":17,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2023-03-05T20:02:44.990Z","etag":null,"topics":["documentation-generator","javascript","markdown-generator"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/labbsr0x.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}},"created_at":"2020-06-19T00:33:03.000Z","updated_at":"2023-01-31T18:18:23.000Z","dependencies_parsed_at":"2023-02-05T20:00:35.774Z","dependency_job_id":null,"html_url":"https://github.com/labbsr0x/js-to-markdown","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labbsr0x%2Fjs-to-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labbsr0x%2Fjs-to-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labbsr0x%2Fjs-to-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labbsr0x%2Fjs-to-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labbsr0x","download_url":"https://codeload.github.com/labbsr0x/js-to-markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230382826,"owners_count":18216855,"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":["documentation-generator","javascript","markdown-generator"],"created_at":"2024-12-19T05:15:16.558Z","updated_at":"2024-12-19T05:15:17.223Z","avatar_url":"https://github.com/labbsr0x.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JS-TO-MARKDOWN\n\n![GitHub](https://img.shields.io/github/license/labbsr0x/js-to-markdown)\n[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)\n![GitHub](https://github.com/labbsr0x/js-to-markdown/workflows/Node.js%20CI/badge.svg)\n![documented with js-to-markdown](https://img.shields.io/badge/documented%20with-js--to--markdown-blue)\n\nA node program to generate markdown automatically from js files. Pull requests and Issues are welcome! 😃 🎉\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Running from command line](#running-from-command-line)\n- [Configuration File](#configuration-file)\n- [Configuration File Options](#configuration-file-options)\n- [TAGS used to document the JS Code](#tags-used-to-document-the-js-code)\n- [Examples](#examples)\n  - [Using @CBAll tag](#using-cball-tag)\n  - [Using @CBStart, @CBEnd tags and markdown comments](#using-cbstart-cbend-tags-and-markdown-comments)\n  - [Generating markdown with PropTypes table](#generating-markdown-with-propTypes-table)\n- [Roadmap](#roadmap)\n\n## Getting Started\n\nFirst install js-to-markdown globaly:\n\n```sh\nnpm install js-to-markdown --global\n```\n\n## Running from command line\n\nAfter installing js-to-markdown globaly, you can run it directly from the command line with a variety of useful options.\n\nHere's how to js-to-markdown using `js-to-markdown.config.js` as a configuration file:\n\n```sh\njs-to-markdown -c ./js-to-markdown.config.js\n```\n\n## Configuration File\n\nIs a JavaScript file\n\n```javascript\nmodule.exports = {\n  input: \"../path/to/input/dir\",\n  output: \"../path/to/output/dir\",\n  subfolders: true,\n};\n```\n\n## Configuration File Options\n\n| Option.            | Default | Required | Description                                                                                                         |\n| ------------------ | :-----: | :------: | ------------------------------------------------------------------------------------------------------------------- |\n| `input`            | `none`  |   yes    | Path to the input directory to js files                                                                             |\n| `output`           | `none`  |   yes    | Path to the output directory where the markdown files will be created                                               |\n| `subfolders`       | `true`  |    no    | Search js files in subfolders under `input` directory                                                               |\n| `outputJsMarkdown` | `false` |    no    | If `true` indicates that the output markdown will be writen as a JS file and an `index.js` file will be created too |\n| `propTypesToTable` | `false` |    no    | If `true` generates a table with all file propTypes, if any                                                         |\n\n---\n\n## TAGS used to document the JS Code\n\nTo help in the JS Code documentation it is possible to add some `tags` as commentary in your code to generate a more complete markdown output.\n\nAll tags must be placed at the beginning of the line as a commentary.\n\n⚠️ If there is no tag in the file, the entire code will be treated as a block of code, the same behavior as if using the @CBAll tag.\n\nThe possible `tags` that can be used are:\n\n### `@ignore`\n\nThis tag is used to tell the script to not parse any line of the JS file.\n\nIt has to be placed as the **first line** of the code.\n\n### `@CBAll`\n\nThe @CBAll (CB = Code Block) tag indicates that all lines of JS file needs to be parsed inside a markdown code block notation.\n\n### `@CBStart` and `@CBEnd`\n\nThe @CBStart and @CBEnd (CB = Code Block) indicates that all lines between the start and the end tag will be parsed inside a markdown code block notation.\n\n# Examples\n\n## Using @CBAll tag\n\nReact Native Js code example:\n\n```javascript\n//@CBAll\nimport React from \"react\";\nimport { View, Icon, Container, Text } from \"react-native\";\n\nexport default class Welcome extends React.Component {\n  showApp = (event) =\u003e {\n    const { showApp } = this.props;\n    event.preventDefault();\n\n    if (showApp) {\n      showApp();\n    }\n  };\n\n  render() {\n    return (\n      \u003cContainer\u003e\n        \u003cView style={styles.mainContent}\u003e\n          \u003cIcon name=\"welcome\" size={60} customColor={Colors.Yellow} /\u003e\n          \u003cText h3 style={styles.title}\u003e\n            JS-TO-MARKDOWN\n          \u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Container\u003e\n    );\n  }\n}\n```\n\nThis code generates the `Welcome.md` file at `output` directory defined in the configuration file with:\n\n```\nimport React from \\'react\\';\nimport { View, Icon, Container, Text } from \\'react-native\\';\nexport default class Welcome extends React.Component {\n  showApp = (event) =\u003e {\n    const { showApp } = this.props;\n    event.preventDefault();\n    if (showApp) {\n      showApp();\n    }\n  };\n  render() {\n    return (\n      \u003cContainer\u003e\n        \u003cView style={styles.mainContent}\u003e\n          \u003cIcon name=\\'welcome\\' size={60} customColor={Colors.Yellow} /\u003e\n          \u003cText h3 style={styles.title}\u003e\n            JS-TO-MARKDOWN\n          \u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Container\u003e\n    );\n  }\n}\n```\n\n---\n\n## Using @CBStart, @CBEnd tags and markdown comments\n\nReact Native Js code example:\n\n```javascript\nimport React from \"react\";\nimport { View, Icon, Container, Text } from \"react-native\";\n\n//# This is the Welcome file\n//Exemple code of how to markdown your JS code\n//---\nexport default class Welcome extends React.Component {\n  //## Function to be called when the aplication starts\n  //@CBStart\n  showApp = (event) =\u003e {\n    const { showApp } = this.props;\n    event.preventDefault();\n\n    if (showApp) {\n      showApp();\n    }\n  };\n  //@CBEnd\n\n  //---\n  //## Render Method\n  render() {\n    //@CBStart\n    return (\n      \u003cContainer\u003e\n        \u003cView style={styles.mainContent}\u003e\n          \u003cIcon name=\"welcome\" size={60} customColor={Colors.Yellow} /\u003e\n          \u003cText h3 style={styles.title}\u003e\n            JS-TO-MARKDOWN\n          \u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Container\u003e\n    );\n    //@CBEnd\n  }\n}\n```\n\nThis code generates the `Welcome.md` file at `output` directory defined in the configuration file with:\n\n# This is the Welcome file\n\nExemple code of how to markdown your JS code\n\n---\n\n## Function to be called when the aplication starts\n\n```\n  showApp = (event) =\u003e {\n    const { showApp } = this.props;\n    event.preventDefault();\n    if (showApp) {\n      showApp();\n    }\n  };\n```\n\n---\n\n## Render Method\n\n```\n    return (\n      \u003cContainer\u003e\n        \u003cView style={styles.mainContent}\u003e\n          \u003cIcon name=\\'welcome\\' size={60} customColor={Colors.Yellow} /\u003e\n          \u003cText h3 style={styles.title}\u003e\n            JS-TO-MARKDOWN\n          \u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Container\u003e\n    );\n```\n\n---\n\n## Generating markdown with PropTypes table\n\nTo enable the parse of PropTypes declarations into a table inside markdown is necessary to mark the `propTypesToTable` flag inside the configuration file as `true`\n\nReact Native Js code example:\n\n```javascript\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { View, Icon, Container, Text } from \"react-native\";\n\n//# This is the Welcome file\n//Exemple code of how to markdown your JS code\n//---\nexport default class Welcome extends React.Component {\n  //## Function to be called when the aplication starts\n  //@CBStart\n  showApp = (event) =\u003e {\n    const { showApp } = this.props;\n    event.preventDefault();\n\n    if (showApp) {\n      showApp();\n    }\n  };\n  //@CBEnd\n\n  //---\n  //## Render Method\n  render() {\n    //@CBStart\n    return (\n      \u003cContainer\u003e\n        \u003cView style={styles.mainContent}\u003e\n          \u003cIcon name=\"welcome\" size={60} customColor={Colors.Yellow} /\u003e\n          \u003cText h3 style={styles.title}\u003e\n            JS-TO-MARKDOWN\n          \u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Container\u003e\n    );\n    //@CBEnd\n  }\n}\n\nWelcome.defaultProps = {\n  showApp: () =\u003e {},\n  type: \"highlight\",\n  seccondButtonMode: \"highlight\",\n};\n\nWelcome.propTypes = {\n  /**\n   * Function to be called on app starts\n   */\n  showApp: PropTypes.func,\n  /**\n   * This props enable the account to be removed after process\n   */\n  canRemoveAccount: PropTypes.bool.isRequired,\n  /**\n   * Indicates how the info will be presented to user\n   */\n  type: PropTypes.oneOf([\"highlight\", \"opacity\", \"withoutFeedback\"]),\n  /**\n   * Object with the params to be presented\n   */\n  params: PropTypes.shape({\n    documentType: PropTypes.oneOf(DocumentPreviewScreen.DOCUMENT_TYPES)\n      .isRequired,\n    buttonMode: PropTypes.oneOf([\"highlight\", \"opacity\", \"withoutFeedback\"])\n      .isRequired,\n    resource: PropTypes.string.isRequired,\n    leftButtonLabel: PropTypes.string,\n    leftButtonAction: PropTypes.func,\n    internalParams: PropTypes.shape({\n      resourceLeftLabel: PropTypes.string.isRequired,\n      resourceRightLabel: PropTypes.string,\n    }),\n    rigthButtonLabel: PropTypes.string,\n    rigthButtonAction: PropTypes.func,\n  }),\n  seccondButtonMode: PropTypes.oneOf([\n    \"highlight\",\n    \"opacity\",\n    \"withoutFeedback\",\n  ]),\n  documentType: PropTypes.oneOf(DocumentPreviewScreen.DOCUMENT_TYPES),\n};\n```\n\nThis code generates the `Welcome.md` file at `output` directory defined in the configuration file with:\n\n# This is the Welcome file\n\nExemple code of how to markdown your JS code\n\n---\n\n## Function to be called when the aplication starts\n\n```\n  showApp = (event) =\u003e {\n    const { showApp } = this.props;\n    event.preventDefault();\n    if (showApp) {\n      showApp();\n    }\n  };\n```\n\n---\n\n## Render Method\n\n```\n    return (\n      \u003cContainer\u003e\n        \u003cView style={styles.mainContent}\u003e\n          \u003cIcon name=\\'welcome\\' size={60} customColor={Colors.Yellow} /\u003e\n          \u003cText h3 style={styles.title}\u003e\n            JS-TO-MARKDOWN\n          \u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Container\u003e\n    );\n```\n\n---\n\n## PropTypes\n\n| Property                                     |  Type  |   Default   | Required | Description                                                                                            |\n| -------------------------------------------- | :----: | :---------: | :------: | ------------------------------------------------------------------------------------------------------ |\n| showApp                                      |  func  |  () =\u003e {}   |  false   | Function to be called on app starts                                                                    |\n| canRemoveAccount                             |  bool  |    none     |   true   | This props enable the account to be removed after process                                              |\n| type                                         |  enum  | 'highlight' |  false   | One of: [`highlight`, `opacity`, `withoutFeedback`] - Indicates how the info will be presented to user |\n| params                                       | object |             |  false   | Object with the params to be presented                                                                 |\n|   params.documentType                        |  enum  |    none     |   true   | One of: [DocumentPreviewScreen.DOCUMENT_TYPES]                                                         |\n|   params.buttonMode                          |  enum  |    none     |   true   | One of: [`highlight`, `opacity`, `withoutFeedback`]                                                    |\n|   params.resource                            | string |    none     |   true   |\n|   params.leftButtonLabel                     | string |    none     |  false   |\n|   params.leftButtonAction                    |  func  |    none     |  false   |\n|   params.internalParams                      | object |             |  false   |\n|     params.internalParams.resourceLeftLabel  | string |    none     |   true   |\n|     params.internalParams.resourceRightLabel | string |    none     |  false   |\n|   params.rigthButtonLabel                    | string |    none     |  false   |\n|   params.rigthButtonAction                   |  func  |    none     |  false   |\n| seccondButtonMode                            |  enum  | 'highlight' |  false   | One of: [`highlight`, `opacity`, `withoutFeedback`]                                                    |\n| documentType                                 |  enum  |    none     |  false   | One of: [DocumentPreviewScreen.DOCUMENT_TYPES]                                                         |\n\n## ROADMAP\n\n- Parse [JSDocs](https://jsdoc.app/) tags to markdown;\n- Accept other JS extensions (.jsx, .ts, .tsx, ...) to locate and parse files;\n- Configuration option to choose if the Markdown file will be saved at output directory or where the original file is;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabbsr0x%2Fjs-to-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabbsr0x%2Fjs-to-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabbsr0x%2Fjs-to-markdown/lists"}