{"id":18221140,"url":"https://github.com/k2052/org-to-markdown","last_synced_at":"2025-04-03T01:30:32.293Z","repository":{"id":34915381,"uuid":"189793000","full_name":"k2052/org-to-markdown","owner":"k2052","description":"org mode to markdown/mdx","archived":false,"fork":false,"pushed_at":"2025-03-22T23:06:28.000Z","size":1244,"stargazers_count":32,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T05:44:37.557Z","etag":null,"topics":["ast","converter","javascript","mdx","org-mode","orgmode","unified"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k2052.png","metadata":{"files":{"readme":"README.org","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-06-02T01:30:15.000Z","updated_at":"2025-03-22T23:06:24.000Z","dependencies_parsed_at":"2024-01-16T10:37:20.340Z","dependency_job_id":"32043bfb-717f-4d7a-ac5c-75518afaccbb","html_url":"https://github.com/k2052/org-to-markdown","commit_stats":{"total_commits":83,"total_committers":2,"mean_commits":41.5,"dds":0.2168674698795181,"last_synced_commit":"83b7f2db6a4d1d3482bd49e77418dd1fdc994def"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k2052%2Forg-to-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k2052%2Forg-to-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k2052%2Forg-to-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k2052%2Forg-to-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k2052","download_url":"https://codeload.github.com/k2052/org-to-markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246921867,"owners_count":20855339,"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":["ast","converter","javascript","mdx","org-mode","orgmode","unified"],"created_at":"2024-11-03T21:05:15.482Z","updated_at":"2025-04-03T01:30:31.890Z","avatar_url":"https://github.com/k2052.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"** org-to-markdown\n\nAn org-mode to markdown/mdx converter. Uses [[https://github.com/xiaoxinghu/orgajs][orgajs]] for all the heavy lifting.\n\nHas the following features not found in other converters;\n\n1. MDX support. You can use jsx, import, and export statements!\n2. code blocks with info strings and parameters, e.g =js repl=\n3. Compatible with the [[https://unified.js.org/][unified]] ecosystem (because of orgajs). Want to combine this with remark plugins or mdx plugins? No problem!\n4. JS ecosystem support. Currently a webpack loader and next plugin is available.\n\n** Installation/Usage\n\nThere is a cli, a library, a webpack loader, and [[https://github.com/k2052/org-to-markdown/tree/master/packages/next-orga][next plugin]] available.\n\n*** Syntax\n\nTo write jsx use =begin_export= blocks. These blocks become jsx, import, export and elements. Here is an example:\n\n#+begin_src org\n,#+begin_export import\nimport { ReactComponent } from \"unicorns-are-awesome\";\n,#+end_export\n\n** An org doc\n\n,#+begin_export jsx\n\u003cReactComponent /\u003e\n,#+end_export\n\nA code block with info strings\n\n,#+begin_src javascript repl\n// gets a repl \nconst unicorns = \"are awesome!\";\n,#+end_src\n#+end_src\n\n*** CLI\n\nYou can install and use the cli using npx. The tool takes org via stdin and outputs to stdout:\n\n#+begin_src sh\n$ npx org-to-markdown \u003c Unicorns.org \u003e Unicorns.md\n#+end_src\n\nThe mdxast and the mdast are compatible so if you want to use mdx you just need to use only need to change the file ext:\n\n#+begin_src sh\n$ npx org-to-markdown \u003c Unicorns.org \u003e Unicorns.mdx\n#+end_src\n\n*** Library\n\nThe library exports a convert function, you can use it like this:\n\n#+begin_src js\n  const orgToMarkdown = require(\"org-to-markdown\");\n  const orgString = `\n  * Org file \n\n  - List of stuff\n  - unicorns\n  `;\n\n  (async () =\u003e {\n    const md = await orgToMarkdown(orgString);\n    console.log(md);\n  }); \n#+end_src\n\n*** Using in Unified\n\nThings are built on two unified compatible libraries; orga-remark and mdx-stringify. You can use the orga-remark plugin to convert the orga ast (oast) to mdxast and mdx-stringify to stringify the mdxast. Here is an example:\n\n#+begin_src js\n  const unified = require(\"unified\");\n  const parse = require(\"orga-unified\");\n  const getStdin = require(\"get-stdin\");\n  const orgaToRemark = require(\"orga-remark\");\n  const stringify = require(\"mdx-stringify\");\n\n  (async () =\u003e {\n    const s = await getStdin();\n    const md = await unified()\n      .use(parse)\n      .use(orgaToRemark)\n      .use(stringify)\n      .process(s);\n\n    console.log(md.contents);\n  })();\n#+end_src\n\n*** Webpack\n\nYou can install the webpack loader like this:\n\n#+begin_src sh\n$ npm i @mdx-js/loader orga-loader\n#+end_src\n\nAnd use it like this\n\n#+begin_src js\n  module: {\n    rules: [\n      { test: /\\.org?$/,\n        use: [\n          'babel-loader',\n          '@mdx-js/loader',\n          'orga-loader'\n        ]\n      },\n\n      // ...\n    ]\n  }\n#+end_src\n\nThen you can import your org file:\n\n#+begin_src js\nimport React, { Component } from 'react'\nimport Document, { frontMatter, tableOfContents } from './document.org'\n\nexport default class Something extends Component {\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003ch1\u003e{frontMatter.title}\u003c/h1\u003e\n        \u003cDocument /\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n#+end_src\n\n*** Next\n\nThere is a next plugin [[https://github.com/k2052/org-to-markdown/tree/master/packages/next-orga][next-orga]] for usage instructions see its [[https://github.com/k2052/org-to-markdown/tree/master/packages/next-orga][docs]]\n\n** Planned Features\n\n- Gatsby support \n- Parcel support\n- Drawer support. (maybe some sort of conversion to html attributes)\n\n** Is this useless?\n\nIt is mostly useless :)\n\n** License\n\nLicensed under ISC. © K-2052\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk2052%2Forg-to-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk2052%2Forg-to-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk2052%2Forg-to-markdown/lists"}