{"id":15062982,"url":"https://github.com/poiscript/orgize","last_synced_at":"2025-05-15T03:05:47.032Z","repository":{"id":34082330,"uuid":"148318109","full_name":"PoiScript/orgize","owner":"PoiScript","description":"A Rust library for parsing org-mode files.","archived":false,"fork":false,"pushed_at":"2025-01-27T09:42:50.000Z","size":928,"stargazers_count":308,"open_issues_count":14,"forks_count":36,"subscribers_count":8,"default_branch":"v0.10","last_synced_at":"2025-05-15T03:05:46.377Z","etag":null,"topics":["cli","lsp","org-mode","parser"],"latest_commit_sha":null,"homepage":"https://poiscript.github.io/orgize/","language":"Rust","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/PoiScript.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":"2018-09-11T13:02:47.000Z","updated_at":"2025-05-05T18:34:37.000Z","dependencies_parsed_at":"2024-01-14T06:51:08.133Z","dependency_job_id":"82a07476-a13b-46bd-8831-25b8b48e00ff","html_url":"https://github.com/PoiScript/orgize","commit_stats":{"total_commits":353,"total_committers":5,"mean_commits":70.6,"dds":"0.025495750708215303","last_synced_commit":"5f26c94dcec2a33b37b1c880ace053b29b5d021e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Forgize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Forgize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Forgize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Forgize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PoiScript","download_url":"https://codeload.github.com/PoiScript/orgize/tar.gz/refs/heads/v0.10","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264765,"owners_count":22041793,"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":["cli","lsp","org-mode","parser"],"created_at":"2024-09-24T23:49:35.480Z","updated_at":"2025-05-15T03:05:46.998Z","avatar_url":"https://github.com/PoiScript.png","language":"Rust","readme":"# Orgize\n\n[![Crates.io](https://img.shields.io/crates/v/orgize.svg)](https://crates.io/crates/orgize)\n[![Documentation](https://docs.rs/orgize/badge.svg)](https://docs.rs/orgize)\n[![Build status](https://img.shields.io/github/actions/workflow/status/PoiScript/orgize/ci.yml)](https://github.com/PoiScript/orgize/actions/workflows/ci.yml)\n![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)\n\nA Rust library for parsing org-mode files.\n\nLive Demo: \u003chttps://poiscript.github.io/orgize/\u003e\n\n## Parse\n\nTo parse a org-mode string, simply invoking the `Org::parse` function:\n\n```rust\nuse orgize::{Org, rowan::ast::AstNode};\n\nlet org = Org::parse(\"* DONE Title :tag:\");\nassert_eq!(\n    format!(\"{:#?}\", org.document().syntax()),\n    r#\"DOCUMENT@0..18\n  HEADLINE@0..18\n    HEADLINE_STARS@0..1 \"*\"\n    WHITESPACE@1..2 \" \"\n    HEADLINE_KEYWORD_DONE@2..6 \"DONE\"\n    WHITESPACE@6..7 \" \"\n    HEADLINE_TITLE@7..13\n      TEXT@7..13 \"Title \"\n    HEADLINE_TAGS@13..18\n      COLON@13..14 \":\"\n      TEXT@14..17 \"tag\"\n      COLON@17..18 \":\"\n\"#);\n```\n\nuse `ParseConfig::parse` to specific a custom parse config\n\n```rust\nuse orgize::{Org, ParseConfig, ast::Headline};\n\nlet config = ParseConfig {\n    // custom todo keywords\n    todo_keywords: (vec![\"TASK\".to_string()], vec![]),\n    ..Default::default()\n};\nlet org = config.parse(\"* TASK Title 1\");\nlet hdl = org.first_node::\u003cHeadline\u003e().unwrap();\nassert_eq!(hdl.todo_keyword().unwrap(), \"TASK\");\n```\n\n## Traverse\n\nUse `org.traverse(\u0026mut traversal)` to walk through the syntax tree.\n\n```rust\nuse orgize::{\n    export::{from_fn, Container, Event},\n    Org,\n};\n\nlet mut hdl_count = 0;\nlet mut handler = from_fn(|event| {\n    if matches!(event, Event::Enter(Container::Headline(_))) {\n        hdl_count += 1;\n    }\n});\nOrg::parse(\"* 1\\n** 2\\n*** 3\\n****4\").traverse(\u0026mut handler);\nassert_eq!(hdl_count, 3);\n```\n\n## Modify\n\nUse `org.replace_range(TextRange::new(start, end), \"new_text\")` to modify the syntax tree:\n\n```rust\nuse orgize::{Org, ParseConfig, ast::Headline, TextRange};\n\nlet mut org = Org::parse(\"hello\\n* world\");\n\nlet hdl = org.first_node::\u003cHeadline\u003e().unwrap();\norg.replace_range(hdl.text_range(), \"** WORLD!\");\n\nlet hdl = org.first_node::\u003cHeadline\u003e().unwrap();\nassert_eq!(hdl.level(), 2);\n\norg.replace_range(TextRange::up_to(hdl.start()), \"\");\nassert_eq!(org.to_org(), \"** WORLD!\");\n```\n\n## Render to html\n\nCall the `Org::to_html` function to export org element tree to html:\n\n```rust\nuse orgize::Org;\n\nassert_eq!(\n    Org::parse(\"* title\\n*section*\").to_html(),\n    \"\u003cmain\u003e\u003ch1\u003etitle\u003c/h1\u003e\u003csection\u003e\u003cp\u003e\u003cb\u003esection\u003c/b\u003e\u003c/p\u003e\u003c/section\u003e\u003c/main\u003e\"\n);\n```\n\nCheckout `examples/html-slugify.rs` on how to customizing html export process.\n\n## Features\n\n- **`chrono`**: adds the ability to convert `Timestamp` into `chrono::NaiveDateTime`, disabled by default.\n\n- **`indexmap`**: adds the ability to convert `PropertyDrawer` properties into `IndexMap`, disabled by default.\n\n## API compatibility\n\n`element.syntax()` exposes access to the internal syntax tree, along with some rowan low-level APIs.\nThis can be useful for intricate tasks.\n\nHowever, the structure of the internal syntax tree can change between different versions of the library.\nBecause of this, the result of `element.syntax()` doesn't follow semantic versioning,\nwhich means updates might break your code if it relies on this method.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoiscript%2Forgize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoiscript%2Forgize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoiscript%2Forgize/lists"}