Convert MediaWiki to TOML
Max file size 100mb.
MediaWiki vs TOML Format Comparison
| Aspect | MediaWiki (Source Format) | TOML (Target Format) |
|---|---|---|
| Format Overview |
MediaWiki
MediaWiki Markup Language
Lightweight markup language created for Wikipedia in 2002 and used by all MediaWiki-powered wikis. Uses distinctive syntax with == headings ==, '''bold''', ''italic'', [[links]], and {| tables |} for collaborative web content creation and editing. Wiki Markup Plain Text |
TOML
Tom's Obvious, Minimal Language
Configuration file format created by Tom Preston-Werner in 2013. Designed to be easy to read and write with clear semantics that map unambiguously to a hash table. Uses sections, key-value pairs, and supports native data types including strings, integers, floats, booleans, dates, arrays, and tables. Configuration Key-Value |
| Technical Specifications |
Structure: Plain text with wiki markup
Encoding: UTF-8 Format: Text-based markup language Compression: None (plain text) Extensions: .mediawiki, .wiki, .txt |
Structure: Key-value pairs with sections
Encoding: UTF-8 Format: Configuration file format Compression: None (plain text) Extensions: .toml |
| Syntax Examples |
MediaWiki uses wiki-style markup: == Section Heading ==
'''Bold text''' and ''italic''
* Bullet list item
# Numbered list item
[[Internal Link]]
{{Template:Infobox}}
|
TOML uses key-value pairs: [section] title = "Section Heading" description = "Some content" [section.settings] enabled = true count = 42 tags = ["wiki", "content"] |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2002 (MediaWiki 1.0)
Current Version: MediaWiki 1.42 (2024) Status: Actively maintained and developed Evolution: Regular updates with new features |
Introduced: 2013 (Tom Preston-Werner)
Current Version: TOML v1.0.0 (2021) Status: Stable, actively maintained Evolution: Reached 1.0 specification milestone |
| Software Support |
MediaWiki: Native rendering engine
Wikipedia: Primary content format Pandoc: Full conversion support Other: Any text editor for source editing |
Rust/Cargo: Native support (Cargo.toml)
Python: tomllib (3.11+), tomli, toml Go: BurntSushi/toml, pelletier/go-toml Other: Libraries for all major languages |
Why Convert MediaWiki to TOML?
Converting MediaWiki markup to TOML format is useful when you need to extract structured data from wiki pages and store it in a clean, typed configuration format. Wiki pages often contain structured information such as software specifications, project parameters, server configurations, or metadata that can be more effectively managed as TOML key-value pairs with proper data typing.
MediaWiki content is designed for human reading through a web browser, with formatting markup that adds visual structure but makes programmatic data extraction difficult. TOML, on the other hand, is specifically designed for machine-readable configuration with unambiguous data types. Converting wiki documentation about system settings, project parameters, or configuration values into TOML creates files that can be directly consumed by applications and build tools.
This conversion is particularly relevant for development teams that maintain configuration documentation on internal wikis. Rather than manually copying values from wiki pages into configuration files, converting the MediaWiki source to TOML automates the process and reduces transcription errors. The resulting TOML files can be used directly with Rust projects (Cargo.toml), Python projects (pyproject.toml), Hugo sites, or any application that reads TOML configuration.
The conversion process maps MediaWiki sections to TOML tables, list items to arrays, and key-value information from wiki tables or definition lists to typed TOML entries. Headings become section headers, and structured data within the wiki content is extracted and formatted according to TOML specification rules, preserving the logical hierarchy of the original wiki content.
Key Benefits of Converting MediaWiki to TOML:
- Data Extraction: Pull structured data from wiki pages into typed configuration files
- Build Integration: Generate Cargo.toml, pyproject.toml, and other project configs from wiki specs
- Type Safety: TOML enforces data types (strings, integers, booleans, dates) that wiki text lacks
- Machine Readable: TOML files are directly parseable by applications and scripts
- Clean Structure: Convert complex wiki markup into simple, readable key-value pairs
- DevOps Workflows: Automate configuration management from documented wiki specifications
- Version Control: TOML files work well with Git diff and merge operations
Practical Examples
Example 1: Project Configuration Extraction
Input MediaWiki file (project_config.mediawiki):
== Project Configuration ==
=== Package Info ===
* '''Name:''' my-awesome-project
* '''Version:''' 2.1.0
* '''Authors:''' Alice Smith, Bob Jones
=== Dependencies ===
{| class="wikitable"
|-
! Package !! Version !! Required
|-
| requests || 2.31.0 || Yes
|-
| pandas || 2.2.0 || Yes
|-
| matplotlib || 3.8.0 || No
|}
Output TOML file (project_config.toml):
[project] name = "my-awesome-project" version = "2.1.0" authors = ["Alice Smith", "Bob Jones"] [[project.dependencies]] package = "requests" version = "2.31.0" required = true [[project.dependencies]] package = "pandas" version = "2.2.0" required = true [[project.dependencies]] package = "matplotlib" version = "3.8.0" required = false
Example 2: Server Documentation to Config
Input MediaWiki file (server_settings.mediawiki):
= Server Settings =
== Database ==
* '''Host:''' db.example.com
* '''Port:''' 5432
* '''Name:''' production_db
* '''SSL:''' enabled
== Cache ==
* '''Provider:''' Redis
* '''Host:''' cache.example.com
* '''Port:''' 6379
* '''TTL:''' 3600
{{Note|All settings are for the production environment.}}
Output TOML file (server_settings.toml):
# Server Settings # All settings are for the production environment. [database] host = "db.example.com" port = 5432 name = "production_db" ssl = true [cache] provider = "Redis" host = "cache.example.com" port = 6379 ttl = 3600
Example 3: Application Feature Flags
Input MediaWiki file (features.mediawiki):
== Feature Flags == === Authentication === * '''OAuth enabled:''' Yes * '''MFA required:''' No * '''Session timeout:''' 1800 === UI Features === * '''Dark mode:''' Yes * '''Beta features:''' No * '''Max upload size:''' 50
Output TOML file (features.toml):
[features.authentication] oauth_enabled = true mfa_required = false session_timeout = 1800 [features.ui] dark_mode = true beta_features = false max_upload_size = 50
Frequently Asked Questions (FAQ)
Q: What is TOML format?
A: TOML (Tom's Obvious, Minimal Language) is a configuration file format created by Tom Preston-Werner, co-founder of GitHub. It uses a clear key = value syntax with [section] headers, supports typed data (strings, integers, floats, booleans, dates, arrays, tables), and is designed to map unambiguously to a dictionary or hash table. It is widely used in Rust (Cargo.toml) and Python (pyproject.toml) ecosystems.
Q: Why would I convert wiki content to a configuration format?
A: Wiki pages frequently document configuration settings, project parameters, and system specifications in human-readable form. Converting this structured information to TOML creates machine-readable files that can be directly used by applications, build systems, and deployment scripts, eliminating manual transcription and reducing errors.
Q: How are MediaWiki sections mapped to TOML?
A: MediaWiki headings (== Section ==) are converted to TOML table headers ([section]). Subsections become nested tables ([section.subsection]). Key-value information from lists, definition lists, or wiki tables is extracted and formatted as typed TOML entries with appropriate data types inferred from the content.
Q: Does the conversion preserve data types?
A: The converter infers TOML data types from the MediaWiki content. Numeric values become integers or floats, "Yes"/"No" or "true"/"false" become booleans, dates are formatted as TOML datetime values, and everything else is stored as strings. Lists are converted to TOML arrays, and tables may become arrays of tables.
Q: Can I use the output as a Cargo.toml or pyproject.toml?
A: The output is valid TOML that can serve as a starting point for project configuration files. However, Cargo.toml and pyproject.toml have specific required fields and structure. You may need to adjust the converted output to match the exact schema expected by your build tool. The conversion provides the data extraction; you may need to reorganize keys to match the target specification.
Q: How are MediaWiki tables converted to TOML?
A: Wiki tables with structured data are converted to TOML arrays of tables ([[table_name]]). Each row becomes a table entry, with column headers mapped to keys and cell values assigned appropriate TOML types. This allows tabular wiki data to be represented in a structured, queryable format.
Q: What happens to MediaWiki formatting in TOML?
A: TOML is a data format and does not support text formatting. Bold, italic, and other wiki markup are stripped during conversion, leaving only the plain text content. Links are converted to their URL or text representation. The focus is on extracting structured data rather than preserving visual formatting.
Q: Can I convert multiple MediaWiki files to TOML at once?
A: Yes! Upload multiple MediaWiki files simultaneously and each will be independently converted to its own TOML file. This is useful for batch-extracting configuration data from multiple wiki documentation pages into separate TOML configuration files.