Convert YAML to MediaWiki
Max file size 100mb.
YAML vs MediaWiki Format Comparison
| Aspect | YAML (Source Format) | MediaWiki (Target Format) |
|---|---|---|
| Format Overview |
YAML
YAML Ain't Markup Language
A human-readable data serialization language commonly used for configuration files and data exchange between languages. Uses indentation-based structure with key-value pairs, lists, and nested mappings. Emphasizes readability and simplicity over complexity. Data Format Human-Readable |
MediaWiki
MediaWiki Markup Language
The markup language used by Wikipedia and thousands of other wikis powered by MediaWiki software. Features a simple syntax for creating structured wiki pages with headings, links, tables, templates, and categories. Designed for collaborative content creation and easy editing. Wiki Format Collaborative |
| Technical Specifications |
Structure: Indentation-based key-value pairs
Encoding: UTF-8 Format: Plain text data serialization Compression: None Extensions: .yaml, .yml |
Structure: Wiki markup with special syntax
Encoding: UTF-8 Format: Plain text wiki markup Compression: None Extensions: .wiki, .mediawiki, .mw |
| Syntax Examples |
YAML uses indentation and colons: server:
hostname: web01.example.com
ports:
- 80
- 443
features:
- load balancing
- SSL termination
|
MediaWiki uses wiki markup: == Server ==
{| class="wikitable"
|-
! Property !! Value
|-
| Hostname || web01.example.com
|}
=== Ports ===
* 80
* 443
=== Features ===
* Load balancing
* SSL termination
|
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2001 (Clark Evans)
Current Version: YAML 1.2.2 (2021) Status: Actively maintained Evolution: Regular specification updates |
Introduced: 2002 (Wikipedia/MediaWiki)
Current Version: MediaWiki 1.41+ (2024) Status: Actively developed Evolution: Continuous updates with MediaWiki |
| Software Support |
Python: PyYAML, ruamel.yaml
JavaScript: js-yaml, yaml Ruby: Psych (built-in) Other: All major programming languages |
MediaWiki: Native support
Pandoc: Full read/write support Editors: VS Code, Vim, Emacs plugins Other: DokuWiki, Confluence (import) |
Why Convert YAML to MediaWiki?
Converting YAML files to MediaWiki markup is essential when you need to publish structured data on wiki platforms like Wikipedia, internal company wikis, or any MediaWiki-powered knowledge base. YAML stores data efficiently but cannot be directly displayed on wiki pages, while MediaWiki markup creates well-formatted, navigable content that integrates seamlessly with wiki ecosystems.
This conversion is particularly valuable for teams that maintain configuration data, API specifications, or infrastructure definitions in YAML and need to make this information accessible through their organization's wiki. By converting YAML to MediaWiki format, you can create wiki tables, structured pages, and categorized content that is easy to search, browse, and collaboratively edit.
MediaWiki's powerful table syntax is ideal for presenting YAML key-value data in a visually organized way. The conversion maps YAML's hierarchical structure to wiki headings and subheadings, lists to wiki bullet points, and mappings to wiki tables, resulting in content that is immediately useful on any MediaWiki installation.
For organizations using MediaWiki as their documentation platform, this conversion bridges the gap between machine-readable configuration data and human-readable wiki documentation, enabling automated documentation updates and reducing manual content creation overhead.
Key Benefits of Converting YAML to MediaWiki:
- Wiki Integration: Directly usable on any MediaWiki-powered platform
- Structured Tables: YAML data presented in clean wiki tables
- Collaborative Editing: Wiki pages can be updated by the whole team
- Searchable Content: Wiki search indexes the converted documentation
- Categorization: Content can be organized with MediaWiki categories
- Version Tracking: Wiki revision history tracks all changes
- Automated Updates: Re-convert and update wiki pages when YAML changes
Practical Examples
Example 1: Server Inventory Documentation
Input YAML file (servers.yaml):
servers:
- name: web-prod-01
ip: 192.168.1.10
os: Ubuntu 22.04
role: web server
- name: db-prod-01
ip: 192.168.1.20
os: CentOS 9
role: database
Output MediaWiki file (servers.wiki):
== Server Inventory ==
{| class="wikitable sortable"
|-
! Name !! IP Address !! OS !! Role
|-
| web-prod-01 || 192.168.1.10 || Ubuntu 22.04 || Web server
|-
| db-prod-01 || 192.168.1.20 || CentOS 9 || Database
|}
[[Category:Infrastructure]]
[[Category:Server Documentation]]
Example 2: Project Dependencies Wiki Page
Input YAML file (dependencies.yaml):
project: DataPlatform
dependencies:
runtime:
- name: python
version: "3.11"
- name: postgresql
version: "15.4"
development:
- name: pytest
version: "7.4"
- name: black
version: "23.9"
Output MediaWiki file (dependencies.wiki):
== DataPlatform Dependencies ==
=== Runtime Dependencies ===
{| class="wikitable"
|-
! Package !! Version
|-
| Python || 3.11
|-
| PostgreSQL || 15.4
|}
=== Development Dependencies ===
{| class="wikitable"
|-
! Package !! Version
|-
| pytest || 7.4
|-
| black || 23.9
|}
Example 3: Environment Configuration Reference
Input YAML file (environments.yaml):
environments:
production:
url: https://app.example.com
replicas: 3
debug: false
staging:
url: https://staging.example.com
replicas: 1
debug: true
Output MediaWiki file (environments.wiki):
== Environment Configuration ==
=== Production ===
{| class="wikitable"
|-
! Setting !! Value
|-
| URL || https://app.example.com
|-
| Replicas || 3
|-
| Debug || false
|}
=== Staging ===
{| class="wikitable"
|-
! Setting !! Value
|-
| URL || https://staging.example.com
|-
| Replicas || 1
|-
| Debug || true
|}
Frequently Asked Questions (FAQ)
Q: What is MediaWiki markup?
A: MediaWiki markup is the formatting language used by Wikipedia and other wikis running MediaWiki software. It uses simple syntax like == for headings, * for bullet lists, {| |} for tables, and [[ ]] for internal links. It's designed to be easy to learn and enables collaborative content creation on wiki platforms.
Q: Can I paste the converted output directly into a wiki?
A: Yes! The converted MediaWiki markup can be directly pasted into the edit window of any MediaWiki-powered wiki page. The formatting will render correctly, including tables, headings, and lists. You can also use the MediaWiki API to programmatically upload the content for automated documentation workflows.
Q: How are YAML nested structures handled in MediaWiki?
A: YAML nested structures are converted to MediaWiki's hierarchical elements. Top-level keys become main headings (==), nested keys become subheadings (===), key-value pairs are formatted as wiki tables, and lists become wiki bullet points. This preserves the logical organization of your YAML data in a readable wiki format.
Q: Does the conversion support YAML arrays and lists?
A: Yes. YAML arrays (sequences) are converted to MediaWiki bullet lists (* item) or numbered lists (# item), depending on context. Arrays of objects with consistent keys are converted to wiki tables with headers, making tabular data easy to read and compare on the wiki page.
Q: Can I use this for Wikipedia articles?
A: The output uses standard MediaWiki markup that is compatible with Wikipedia. However, Wikipedia has specific style guidelines and notability requirements. The converted content would be suitable as a starting point for structured data sections in Wikipedia articles, but you would need to add prose, citations, and ensure compliance with Wikipedia's editorial policies.
Q: Will MediaWiki templates be generated during conversion?
A: The basic conversion produces standard MediaWiki markup with tables, headings, and lists. It does not automatically generate custom templates, as templates are wiki-specific and vary between installations. However, the output can be easily adapted to use your wiki's existing templates by editing the converted markup.
Q: Is MediaWiki markup the same as wikitext?
A: Yes, "MediaWiki markup" and "wikitext" refer to the same formatting language. It is sometimes also called "wiki markup" or "wiki syntax." All these terms describe the plain text formatting used by MediaWiki software to render formatted wiki pages with headings, tables, links, and other elements.
Q: Can I automate regular YAML-to-wiki updates?
A: Yes! You can integrate this conversion into automated workflows. Convert your YAML files to MediaWiki markup and use the MediaWiki API (api.php) to update wiki pages programmatically. This is ideal for keeping infrastructure documentation, configuration references, or project specifications in sync with your actual YAML configuration files.