All tools
Free · Private · No upload

Convert Markdown to XML Online

Convert a Markdown table into XML, with one element per row. The table is read in your browser and never uploaded.

Drop a CSV or Excel file here

CSV · XLSX · XLS · XLSM · XLSB

or paste your data below

How to convert a Markdown table to XML

Three steps from options.md to XML.

1. Paste the table

Paste a Markdown pipe table or drop a .md file.

2. Check it in the grid

Remove the backticks around option names if the XML should hold plain values.

3. Name the tags

Set the root and row tag names, choose elements or attributes, toggle pretty printing, then copy or download data.xml.

Example: Markdown in, XML out

A configuration reference with option names in backticks and an ampersand in a description.

options.md
| Option      | Default | Description                       |
| ----------- | ------- | --------------------------------- |
| `timeout`   | 30      | Seconds before a request fails    |
| `retries`   | 3       | Attempts for 5xx & network errors |
data.xml (default options)
<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <Option>`timeout`</Option>
    <Default>30</Default>
    <Description>Seconds before a request fails</Description>
  </row>
  <row>
    <Option>`retries`</Option>
    <Default>3</Default>
    <Description>Attempts for 5xx &amp; network errors</Description>
  </row>
</rows>

The backticks around timeout are kept as text, because only &, <, >, " and ' need escaping in XML; the & in the description becomes &amp;.

What changes between Markdown and XML

Structure

An XML declaration, a <rows> root, one <row> per data row and one child element per column. Root and row names are editable; characters that aren't allowed are replaced with _.

Tag names come from headers

Column elements are named after the headers (<Option>, <Default> and <Description>). Spaces and symbols would become _, and a header starting with a digit would get a col_ prefix.

Inline Markdown stays literal

Cells are read as text, not rendered: `timeout` keeps its markers in the XML. An escaped \| inside a cell becomes a plain |.

When to convert Markdown to XML

Markdown to XML in JavaScript

A pipe table is easy to split by hand. Then headers become tag names and values are escaped for XML.

import { readFile } from 'node:fs/promises';

const lines = (await readFile('options.md', 'utf8')).split('\n').filter((l) => l.includes('|'));
const cells = (line) => line.trim().replace(/^\||\|$/g, '')
  .split(/(?<!\\)\|/).map((c) => c.trim().replace(/\\\|/g, '|'));
const header = cells(lines[0]);
const rows = lines.slice(2).map(cells); // lines[1] is the separator

const tag = (h) => String(h).trim().replace(/[^A-Za-z0-9_]/g, '_');
const esc = (v) => String(v ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
console.log('<?xml version="1.0" encoding="UTF-8"?>\n<rows>\n' + rows.map((row) =>
  '  <row>\n' + header.map((h, i) => `    <${tag(h)}>${esc(row[i])}</${tag(h)}>`).join('\n') + '\n  </row>'
).join('\n') + '\n</rows>');

Like this page, the split skips the separator line and honours escaped pipes.

npm install tabularjs MIT licensed

Frequently asked questions

Can I choose the element names?

Yes. Root tag and Row tag are editable (for example plans and plan), and the column elements take the header names.

Does Markdown formatting become XML elements?

No. Backticks and asterisks stay as characters; they are not turned into <code> or <em> elements.

What counts as a Markdown table?

A header row, a separator row made of dashes (with optional colons) and data rows, separated by |. The pipes at the start and end of each line are optional.

Can I get compact XML without indentation?

Untick Pretty print and the whole document is written without indentation or line breaks. For one compact element per row, choose Attributes mode instead.

Does options.md get uploaded when I convert it to XML?

No. The table is read in your browser and never uploaded.