{"id":25821373,"url":"https://github.com/marcmarine/omuso","last_synced_at":"2026-03-10T10:31:49.780Z","repository":{"id":318717488,"uuid":"1069316455","full_name":"marcmarine/omuso","owner":"marcmarine","description":"Converts Markdown to a structured JSON format.","archived":false,"fork":false,"pushed_at":"2026-01-24T16:35:26.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-24T15:07:31.500Z","etag":null,"topics":["ebooks","markdown","parser","reader"],"latest_commit_sha":null,"homepage":"https://dev.omuso.org/","language":"TypeScript","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/marcmarine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-03T18:30:30.000Z","updated_at":"2026-01-24T16:40:44.000Z","dependencies_parsed_at":"2025-10-11T16:07:30.806Z","dependency_job_id":"7e43af7a-ddfa-47b5-b63d-1255d221368f","html_url":"https://github.com/marcmarine/omuso","commit_stats":null,"previous_names":["marcmarine/omuso"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/marcmarine/omuso","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmarine%2Fomuso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmarine%2Fomuso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmarine%2Fomuso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmarine%2Fomuso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcmarine","download_url":"https://codeload.github.com/marcmarine/omuso/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcmarine%2Fomuso/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30330555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ebooks","markdown","parser","reader"],"created_at":"2025-02-28T10:55:01.777Z","updated_at":"2026-03-10T10:31:49.743Z","avatar_url":"https://github.com/marcmarine.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OMUSO Markdown Parser\n\nA small TypeScript library that turns Markdown into structured JSON, keeping the document’s hierarchy and some text styles.\n\n[![NPM Version](https://img.shields.io/npm/v/omuso)](https://www.npmjs.com/package/omuso)\n[![GitHub License](https://img.shields.io/github/license/marcmarine/omuso)](LICENSE)\n[![View Changelog](https://img.shields.io/badge/view-CHANGELOG.md-red.svg)](https://github.com/marcmarine/omuso/releases)\n![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/omuso)\n\n## Key Features\n\n- **Hierarchical Structure**: Headings (#, ##, etc.) create nested sections, building a clear document tree\n- **Text Formatting Preservation**: Italic text are kept with their position in the tex\n- **Frontmatter Support**: YAML metadata is extracted and linked to document propertie\n- **TypeScript First**: Full type definitions for smooth development experience\n- **Lightweight**: Zero dependencies, designed for efficient parsing\n\n## Why another parser?\n\nUnlike typical Markdown parsers that build detailed syntax trees, the **OMUSO Markdown Parser** focuses on the logical hierarchy of documents. It uses headings not just to identify formatting but to define nested sections, making each heading start a new node with its related content.\n\nThis method is helpful when Markdown encodes semantic structure as well as visual formatting. The parser outputs a well-organized JSON object that reflects the author’s intended document layout, making it easier for developers to understand and work with the content.\n\n## Installation\n\n```bash\nnpm install omuso\n```\n\n## Quick Start\n\n```typescript\nimport { parse } from 'omuso'\n\nconst markdown = `# Hello World\n\nThis is a simple paragraph.\n\n## Section 1\n\nAnother paragraph with *italic text*.\n`\n\nconst result = parse(markdown)-\n// Result structure:\n// {\n//   \"type\": \"root\",\n//   \"title\": \"Hello World\",\n//   \"content\": [\n//     {\n//       \"path\": \"1\",\n//       \"type\": \"section\",\n//       \"title\": \"Hello World\",\n//       \"slug\": \"/hello-world\",\n//       \"depth\": 1,\n//       \"content\": [\n//         {\n//           \"path\": \"1_1\",\n//           \"type\": \"paragraph\",\n//           \"value\": \"This is a simple paragraph.\",\n//           \"slug\": \"/hello-world#1\",\n//           \"marks\": []\n//         },\n//         {\n//           \"path\": \"1.1\",\n//           \"type\": \"section\",\n//           \"title\": \"Section 1\",\n//           \"slug\": \"/hello-world/section-1\",\n//           \"depth\": 2,\n//           \"content\": [\n//             {\n//               \"path\": \"1.1_1\",\n//               \"type\": \"paragraph\",\n//               \"value\": \"Another paragraph with italic text.\",\n//               \"slug\": \"/hello-world/section-1#1\",\n//               \"marks\": [\n//                 {\n//                   \"type\": \"emphasis\",\n//                   \"start\": 23,\n//                   \"end\": 34\n//                 }\n//               ]\n//             }\n//           ]\n//         }\n//       ]\n//     }\n//   ]\n// }\n```\n\n## API Reference\n\n### `parse(text: string): Root`\n\nConverts a Markdown string to a structured JSON representation.\n\n**Parameters:**\n- `text`: The Markdown content as a string\n\n**Returns:**\n- `Root`: The root node containing the parsed document structure\n\n### Type Definitions\n\n#### `Root`\n\nThe top-level document node.\n\n```typescript\ninterface Root {\n  type: 'root'\n  title?: string\n  author?: string\n  language?: string\n  translator?: string\n  date?: string\n  content: (Section | Paragraph)[]\n}\n```\n\n#### `Section`\n\nRepresents a heading and its content.\n\n```typescript\ninterface Section {\n  type: 'section'\n  path: string\n  title: string\n  slug: string\n  depth: number\n  content: (Section | Paragraph)[]\n}\n```\n\n#### `Paragraph`\n\nRepresents a paragraph with text formatting marks.\n\n```typescript\ninterface Paragraph {\n  type: 'paragraph'\n  path: string\n  value: string\n  slug: string\n  marks: InlineMark[]\n}\n```\n\n#### `InlineMark`\n\nDefines formatting applied to text ranges.\n\n```typescript\ninterface InlineMark {\n  type: 'emphasis'\n  start: number\n  end: number\n}\n```\n\n## Usage Examples\n\n### Basic Document\n\n```typescript\nimport { parse } from 'omuso'\n\nconst markdown = `# Hello World\n\nThis is a simple paragraph.\n\n## Section 1\n\nAnother paragraph with *italic text*.\n`\n\nconst result = parse(markdown)\n// Result structure:\n// {\n//   \"type\": \"root\",\n//   \"title\": \"Hello World\",\n//   \"content\": [\n//     {\n//       \"path\": \"1\",\n//       \"type\": \"section\",\n//       \"title\": \"Hello World\",\n//       \"slug\": \"/hello-world\",\n//       \"depth\": 1,\n//       \"content\": [\n//         {\n//           \"path\": \"1_1\",\n//           \"type\": \"paragraph\",\n//           \"value\": \"This is a simple paragraph.\",\n//           \"slug\": \"/hello-world#1\",\n//           \"marks\": []\n//         },\n//         {\n//           \"path\": \"1.1\",\n//           \"type\": \"section\",\n//           \"title\": \"Section 1\",\n//           \"slug\": \"/hello-world/section-1\",\n//           \"depth\": 2,\n//           \"content\": [\n//             {\n//               \"path\": \"1.1_1\",\n//               \"type\": \"paragraph\",\n//               \"value\": \"Another paragraph with italic text.\",\n//               \"slug\": \"/hello-world/section-1#1\",\n//               \"marks\": [\n//                 {\n//                   \"type\": \"emphasis\",\n//                   \"start\": 23,\n//                   \"end\": 34\n//                 }\n//               ]\n//             }\n//           ]\n//         }\n//       ]\n//     }\n//   ]\n// }\n```\n\n### Document with Frontmatter\n\n```typescript\nconst markdownWithFrontmatter = `---\ntitle: La Iliada\nauthor: Homer\nlanguage: ca\ntranslator: Conrad Roure i Bofill\ndate: 1879-01-01\n---\n\n## Cant I\n\nCanta, deesa, la cólera d'Aquiles, fill de Peleo, cólera fatal que abocá un sens fí de mals...\n`\n\nconst result = parse(markdownWithFrontmatter)\n// The frontmatter data will be available in the root node properties\nconsole.log(result.title)      // \"La Iliada\"\nconsole.log(result.author)     // \"Homer\"\nconsole.log(result.language)   // \"ca\"\n```\n\n### Text Formatting\n\nThe library supports emphasis formatting using both `*` and `_` delimiters:\n\n```typescript\nconst markdown = `Paragraph with *asterisk emphasis* and _underscore emphasis_.`\n\nconst result = parse(markdown)\nconst paragraph = result.content[0] as ParagraphNode\n\nconsole.log(paragraph.content) // \"Paragraph with asterisk emphasis and underscore emphasis.\"\nconsole.log(paragraph.marks)   // [\n                               //   { type: 'emphasis', start: 15, end: 33 },\n                               //   { type: 'emphasis', start: 38, end: 57 }\n                               // ]\n```\n\n### Nested Sections\n\n```typescript\nconst markdown = `# Main Title\n\n## Chapter 1\n\nIntroduction paragraph.\n\n### Section 1.1\n\nSubsection content.\n\n### Section 1.2\n\nAnother subsection.\n\n## Chapter 2\n\nSecond chapter content.\n`\n\nconst result = parse(markdown)\n// Creates a hierarchical structure with nested sections\n```\n\n## Supported Markdown Features\n\n- ✅ **Headers** (H1-H6) - Converted to sections with depth\n- ✅ **Paragraphs** - Text content with formatting marks\n- ✅ **Emphasis** - `*italic*` and `_italic_` text\n- ✅ **Frontmatter** - YAML-style metadata parsing\n- ❌ **Strong text** - Coming soon...\n- ❌ **Lists** - Not currently supported\n- ❌ **Links** - Not currently supported\n- ❌ **Images** - Not currently supported\n- ❌ **Code blocks** - Not currently supported\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Run tests\nbun test\n\n# Build the package\nbun run build\n```\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcmarine%2Fomuso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcmarine%2Fomuso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcmarine%2Fomuso/lists"}