Convert ORG to TOML
Max file size 100mb.
ORG vs TOML Format Comparison
| Aspect | ORG (Source Format) | TOML (Target Format) |
|---|---|---|
| Format Overview |
ORG
Emacs Org-mode
Plain text markup format created for Emacs in 2003. Designed for note-taking, task management, project planning, and literate programming. Features hierarchical structure with collapsible sections, TODO states, scheduling, and code execution. Emacs Native Literate Programming |
TOML
Tom's Obvious, Minimal Language
Configuration file format created by Tom Preston-Werner in 2013. Designed to be easy to read due to obvious semantics. Used extensively for configuration in Rust (Cargo.toml), Python (pyproject.toml), and many modern applications. Configuration Rust/Python Ecosystem |
| Technical Specifications |
Structure: Hierarchical outline with * headers
Encoding: UTF-8 Format: Plain text with markup Processor: Emacs Org-mode, Pandoc Extensions: .org |
Structure: Key-value pairs with sections
Encoding: UTF-8 Format: Configuration file format Processor: Native parsers in most languages Extensions: .toml |
| Syntax Examples |
Org-mode syntax: #+TITLE: Project Config #+AUTHOR: John Doe * Project :PROPERTIES: :name: myproject :version: 1.0.0 :END: ** Dependencies - numpy >= 1.20 - pandas >= 1.3 ** Settings - debug: true - port: 8080 |
TOML syntax: [project] name = "myproject" version = "1.0.0" [project.dependencies] numpy = ">= 1.20" pandas = ">= 1.3" [settings] debug = true port = 8080 |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2003 (Carsten Dominik)
Current Version: 9.6+ (2024) Status: Active development Primary Tool: GNU Emacs |
Introduced: 2013 (Tom Preston-Werner)
Current Version: TOML v1.0.0 (2021) Status: Stable specification Primary Tool: Native language parsers |
| Software Support |
Emacs: Native support (Org-mode)
Vim/Neovim: org.nvim, vim-orgmode VS Code: Org Mode extension Other: Logseq, Obsidian (plugins) |
Rust: toml crate (native)
Python: tomllib (3.11+), toml JavaScript: @iarna/toml, toml-js Go: BurntSushi/toml |
Why Convert ORG to TOML?
Converting Org-mode documents to TOML format is useful when you need to extract structured data from your Org files for use in configuration files or data processing. While Org-mode stores information in a document-centric format, TOML provides a strict, typed configuration format ideal for software settings.
TOML has become the standard configuration format for Rust projects (Cargo.toml) and Python projects (pyproject.toml). If you maintain project metadata or settings in Org-mode and need to generate proper configuration files, converting to TOML produces machine-readable output that integrates with modern build systems.
The conversion is particularly valuable for developers who use Org-mode for project planning and documentation but need to export configuration data. Properties, structured lists, and table data in Org-mode can be transformed into TOML's key-value sections format.
TOML's strict typing and clear semantics make it excellent for configuration that needs to be parsed reliably. Unlike Org-mode's flexible formatting, TOML ensures that strings, numbers, booleans, and dates are unambiguously represented, reducing configuration errors.
Key Benefits of Converting ORG to TOML:
- Configuration Standard: Generate Cargo.toml, pyproject.toml
- Strict Typing: Clear data type representation
- Machine Readable: Easy parsing in any language
- Build Systems: Integrate with modern toolchains
- Date/Time Support: Native RFC 3339 date handling
- Clear Semantics: No ambiguous syntax
- Wide Support: Libraries for all major languages
Practical Examples
Example 1: Project Configuration
Input ORG file (project.org):
#+TITLE: My Project * Package :PROPERTIES: :name: mypackage :version: 0.1.0 :description: A sample package :END: * Authors - Alice Smith <[email protected]> - Bob Jones <[email protected]> * Dependencies | Package | Version | |---------+---------| | numpy | 1.21 | | pandas | 1.3 |
Output TOML file (project.toml):
[package] name = "mypackage" version = "0.1.0" description = "A sample package" [[authors]] name = "Alice Smith" email = "[email protected]" [[authors]] name = "Bob Jones" email = "[email protected]" [dependencies] numpy = "1.21" pandas = "1.3"
Example 2: Application Settings
Input ORG file (settings.org):
* Server Settings :PROPERTIES: :host: localhost :port: 8080 :debug: true :END: * Database :PROPERTIES: :driver: postgresql :host: db.example.com :port: 5432 :name: myapp :END: * Features - authentication: enabled - caching: enabled - logging: verbose
Output TOML file (settings.toml):
[server] host = "localhost" port = 8080 debug = true [database] driver = "postgresql" host = "db.example.com" port = 5432 name = "myapp" [features] authentication = "enabled" caching = "enabled" logging = "verbose"
Example 3: Build Configuration
Input ORG file (build.org):
* Build Profile ** Development - optimize: false - debug_symbols: true - warnings: all ** Release - optimize: true - debug_symbols: false - lto: true * Targets | Name | Path | |--------+---------------| | lib | src/lib.rs | | binary | src/main.rs |
Output TOML file (build.toml):
[profile.development] optimize = false debug_symbols = true warnings = "all" [profile.release] optimize = true debug_symbols = false lto = true [[targets]] name = "lib" path = "src/lib.rs" [[targets]] name = "binary" path = "src/main.rs"
Frequently Asked Questions (FAQ)
Q: What is TOML?
A: TOML (Tom's Obvious, Minimal Language) is a configuration file format created by Tom Preston-Werner in 2013. It aims to be easy to read due to obvious semantics and maps unambiguously to a hash table. TOML is used as the configuration format for Rust's Cargo, Python's pyproject.toml, and many other modern tools.
Q: How are Org-mode properties converted?
A: Org-mode property drawers (:PROPERTIES: ... :END:) map naturally to TOML key-value pairs. Properties under a heading become keys in a TOML section (table) named after that heading. This makes the conversion logical for structured configuration data.
Q: What happens to Org-mode tables?
A: Org-mode tables can be converted to TOML arrays of tables ([[table_name]]) where each row becomes an entry. Alternatively, simple two-column tables with key-value pairs can become inline tables or regular key-value entries in a section.
Q: Can I use this for Cargo.toml generation?
A: Yes! If your Org file contains structured project metadata (name, version, dependencies), it can be converted to Cargo.toml format. However, you may need to adjust the output to match Cargo's specific schema requirements.
Q: How are data types handled?
A: TOML has strict typing. During conversion, the tool attempts to infer types: numbers become integers or floats, true/false become booleans, and other values become strings. Dates in ISO format are converted to TOML's native datetime type.
Q: What about document content like paragraphs?
A: TOML is designed for configuration data, not documents. Prose content, formatted text, and narrative sections from Org-mode don't have natural TOML equivalents and may be omitted or converted to multi-line strings. For document conversion, consider formats like Markdown or AsciiDoc instead.
Q: Can I convert TOML back to Org-mode?
A: Yes, TOML data can be converted back to Org-mode format. TOML sections become Org headings, and key-value pairs become properties. This is useful for importing configuration data into your Org-mode workflow for editing and documentation.
Q: Is the output valid TOML?
A: Yes, the converter produces TOML 1.0.0 compliant output that can be parsed by any TOML library. You can validate the output using tools like `toml-cli` or online TOML validators.