{"id":13799346,"url":"https://github.com/benjycui/mark-twain","last_synced_at":"2025-06-20T17:07:27.245Z","repository":{"id":66125049,"uuid":"47173578","full_name":"benjycui/mark-twain","owner":"benjycui","description":"Parse Markdown into JavaScript object.","archived":false,"fork":false,"pushed_at":"2019-11-06T18:42:06.000Z","size":28,"stargazers_count":89,"open_issues_count":4,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-20T17:06:15.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/benjycui.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-12-01T07:38:18.000Z","updated_at":"2023-12-05T21:43:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c99140a-9f3c-416d-9c2f-600be8bf1248","html_url":"https://github.com/benjycui/mark-twain","commit_stats":{"total_commits":53,"total_committers":5,"mean_commits":10.6,"dds":"0.13207547169811318","last_synced_commit":"3b31ddb44860a656d914f20ad64a2aaf747dc602"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/benjycui/mark-twain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fmark-twain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fmark-twain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fmark-twain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fmark-twain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjycui","download_url":"https://codeload.github.com/benjycui/mark-twain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fmark-twain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260985170,"owners_count":23092885,"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-08-04T00:01:01.774Z","updated_at":"2025-06-20T17:07:22.216Z","avatar_url":"https://github.com/benjycui.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Mark Twain\n\n[![](https://img.shields.io/travis/benjycui/mark-twain.svg?style=flat-square)](https://travis-ci.org/benjycui/mark-twain)\n[![npm package](https://img.shields.io/npm/v/mark-twain.svg?style=flat-square)](https://www.npmjs.org/package/mark-twain)\n[![NPM downloads](http://img.shields.io/npm/dm/mark-twain.svg?style=flat-square)](https://npmjs.org/package/mark-twain)\n[![Dependency Status](https://david-dm.org/benjycui/mark-twain.svg?style=flat-square)](https://david-dm.org/benjycui/mark-twain)\n\nIt is not easy to process Markdown directly. However, we can use `mark-twain` to parse a Markdown file(and YAML/HTML which in it) into [JsonML](http://www.jsonml.org/) which is easier to process.\n\n## Installation\n\n```bash\nnpm install mark-twain\n```\n\n## Usage\n\n```js\nconst MT = require('mark-twain');\nconst fs = require('fs');\nconst jsonML = MT(fs.readFileSync('something.md').toString());\n```\n\nThe returned value of `MT` would be JsonML, something looks like this:\n\n```js\n{\n  // YAML will be parsed as meta data.\n  meta: {\n    title: 'Title',\n    ...\n  },\n\n  // Others will be parsed as JsonML.\n  content:  [\n    \"article\",\n    [\"h1\", \"Here is a heading\"],\n    [\n      \"ol\",\n      [\n        \"li\",\n        [\n          \"p\",\n          \"First\"\n        ]\n      ],\n      ...\n    ],\n    [\n      \"p\",\n      \"This is a paragraph, including \",\n      [\n        \"em\",\n        \"EM\"\n      ],\n      \" and \",\n      [\n        \"strong\",\n        \"STRONG\"\n      ],\n      \". Any question? Oh, I almost forget \",\n      [\n        \"code\",\n        \"inline code\"\n      ],\n      \".\"\n    ],\n    ...\n  ]\n}\n```\n\n## Relative\n\n* [jsonml-to-react-component](https://github.com/benjycui/jsonml-to-react-component) To convert JsonML to React Component.\n* [jsonml.js](https://github.com/benjycui/jsonml.js) A collection of JsonML tools.\n\n## Liscence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjycui%2Fmark-twain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjycui%2Fmark-twain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjycui%2Fmark-twain/lists"}