13 September 2026
Converting FictionBook 2.0 (FB2) E-Books to Markdown: XML Structure and Semantics
In the early 2000s, software architects Dmitry Gribov and Michael Matsnev recognized a critical flaw in electronic publishing formats. Most e-books (like early PDF and proprietary Mobipocket formats) focused purely on visual layout, ignoring document semantics.
To create an open, future-proof standard for digital literature, they designed FictionBook 2.0 (.fb2). Unlike EPUB—which bundles a web of HTML, CSS, images, and package descriptors inside a ZIP container—FictionBook encapsulates the entire book, bibliographic metadata, semantic chapters, poems, epigraphs, and base64 illustrations into a single, unified XML document.
Today, millions of novels, academic classics, and public-domain anthologies are archived in FB2. However, modern personal knowledge management (PKM) platforms, static site generators, and mobile Markdown editors cannot parse FB2 XML directly.
This technical guide dissects the forensic XML architecture of FictionBook 2.0 files, explains how literary structures and metadata are mapped, and demonstrates how convrtr's FictionBook to Markdown engine transforms FB2 manuscripts into clean, semantic GitHub Flavored Markdown (GFM) directly inside your browser.
The FictionBook 2.0 XML Architecture
An .fb2 document is governed by the http://www.gribuser.ru/xml/fictionbook/2.0 schema. Its top-level structure consists of three distinct sections:
<?xml version="1.0" encoding="UTF-8"?>
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
<description>
<title-info>
<genre>sf_cyberpunk</genre>
<author>
<first-name>William</first-name>
<last-name>Gibson</last-name>
</author>
<book-title>Neuromancer</book-title>
<annotation>
<p>The sky above the port was the color of television, tuned to a dead channel.</p>
</annotation>
<date value="1984">1984</date>
<lang>en</lang>
</title-info>
<document-info>
<author><nickname>convrtr-archivist</nickname></author>
<program-used>convrtr FB2 Engine</program-used>
<id>9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d</id>
<version>1.0</version>
</document-info>
</description>
<body>
<title><p>Neuromancer</p></title>
<section>
<title><p>Part 1: Chiba City Blues</p></title>
<epigraph>
<p>The city was a sprawling corporate neon sprawl.</p>
<text-author>Case</text-author>
</epigraph>
<p>The sky above the port was the color of television, tuned to a dead channel.</p>
</section>
</body>
</FictionBook>
1. Bibliographic Metadata (<description>)
The <description> block houses comprehensive publishing metadata across three sub-elements:
<title-info>: Essential literary metadata including<genre>(standardized classifications likesf_space,prose_classic,detective), author details (<first-name>,<middle-name>,<last-name>),<book-title>, synopsis<annotation>, publication<date>, and language code<lang>.<document-info>: Provenance of the digital edition, including scanner credits, creation software, and unique document UUID.<publish-info>: Traditional print details including ISBN, original publisher, and printing year.
2. Semantic Document Body (<body>)
Unlike raw HTML where text is grouped into arbitrary <div> containers, FictionBook enforces strict structural semantics:
<section>: Recursive chapter and sub-chapter hierarchy. Sections can be nested arbitrarily deep to represent books, parts, chapters, and scenes.<title>: Structural heading for the section, containing paragraphs<p>or subtitle elements.<epigraph>: Introductory quotation preceding a chapter, paired with a<text-author>tag.<poem>,<stanza>,<v>: Structured poetic verse. Individual verse lines<v>preserve line breaks without manual HTML<br>tags.<cite>: Block quotation with explicit source citation.<empty-line>: Deliberate typographical pause or scene break.
3. Embedded Binary Payloads (<binary>)
Images, book covers, and decorative chapter headings are encoded directly inside <binary> tags as base64 character blocks at the end of the file, referenced via xlink:href="#image_id" attributes in the body text.
Transforming FB2 Semantics to Markdown
To convert an FB2 manuscript into clean Markdown that renders seamlessly in Obsidian, Logseq, or GitHub, the converter executes a multi-stage semantic transformation:
Stage 1: Frontmatter and Metadata Synthesis
The engine parses <title-info> to build rich YAML frontmatter:
---
title: "Neuromancer"
author: "William Gibson"
genre:
- sf_cyberpunk
date: "1984"
language: "en"
---
Stage 2: Section Depth and Headings
In FictionBook, sections do not declare rigid heading levels (like <h1> or <h3>); instead, heading hierarchy is inferred from <section> nesting depth:
- Root body title becomes
# Book Title. - Level 1
<section><title>becomes## Chapter Title. - Level 2
<section><title>becomes### Section Heading.
Stage 3: Literary Constructs (Poems, Epigraphs, Quotes)
- Epigraphs: Formatted as indented blockquotes with italicized text and author attribution:
> *The city was a sprawling corporate neon sprawl.* > — Case - Poetry and Verse: Poetic stanzas are converted into blockquotes with explicit two-space line breaks to preserve verse meter without collapsing lines:
> First line of poetic meter > Second rhyming cadence > Ending of the stanza - Emphasis and Formatting:
<emphasis>translates to*italic*,<strong>to**bold**,<strikethrough>to~~strike~~, and<subtitle>to bold centered subtitles.
Local-First Privacy for Manuscripts
Books, unpublished literary manuscripts, and private scholarly anthologies frequently contain unreleased intellectual property. Uploading entire book files to remote online converter portals risks content scraping and confidentiality leaks.
Because convrtr executes the entire FictionBook parsing and Markdown serialization pipeline 100% locally inside your browser memory using Web APIs, your books, notes, and manuscripts never leave your personal computer.
Related reading
Converting Emacs Org Mode to Markdown: Outlines, Tables, and Checklists
Explore the syntax and semantics of Emacs Org Mode (.org). Learn how asterisk headings, TODO states, priority tags, Org Calc tables, and code blocks translate to GitHub Flavored Markdown.
Converting Evernote ENEX Notebooks to Markdown: Free Your Notes from Proprietary XML
Learn how Evernote XML Export (.enex) files structure notes, timestamps, tags, and ENML layout markup, and how to convert them into clean GitHub Flavored Markdown with YAML frontmatter.
Converting OPML Outlines and Subscriptions to Markdown: Tables and Hierarchies
Dissect the Outline Processor Markup Language (.opml) architecture. Learn how RSS subscription directories, podcast feeds, and hierarchical task outlines are converted into clean GitHub Flavored Markdown.
Converting PalmDoc (PDB) to Markdown: Vintage Handheld E-Book Architecture
Explore the Palm OS PalmDoc (.pdb / .prc) architecture. Discover 78-byte database headers, record indices, 4KB LZ77 compressed blocks, and browser-based Markdown extraction.
Converting AbiWord (.abw, .zabw) to Markdown: Open-Source Word Processing Recovery
Examine AbiWord's native AWML XML document architecture. Learn how Dublin Core metadata, 2D table grids, styled character spans, GZIP compression, and base64 illustrations convert into clean Markdown.
Converting Hangul Word Processor (HWP) to Markdown: OLE CFB & Deflate Forensics
Unpack Hancom Hangul HWP 5.x compound documents. Discover how OLE 2.0 CFB directory tables, Deflate stream decompression, and HWPTAG_PARA_TEXT record parsers extract clean Markdown in browser memory.
Converting ClarisWorks and AppleWorks CWK to Markdown: Recovering Vintage Mac Documents
Learn how to extract text, paragraphs, and headings from vintage ClarisWorks and AppleWorks (.cwk) MacBinary files into clean GitHub Flavored Markdown with 100% private in-browser decoding.
Converting OpenOffice SXW to Markdown: Unpacking Pre-ODF XML Document Archives
Learn how OpenOffice.org 1.x and StarOffice Writer (.sxw) XML packages work. Discover how to extract text, tables, and lists into clean Markdown directly in your browser.
Converting Apple RTFD Bundles to Markdown: Rich Text & Attachment Extraction
Learn how Apple macOS RTFD compound packages bundle Rich Text Format documents with graphic attachments, and how to convert them into GitHub Flavored Markdown 100% offline.
Converting Wolfram Mathematica Notebooks (.nb) to Markdown: Hierarchical Expression Tree Extraction
Learn how Wolfram Mathematica (.nb) computational notebooks store hierarchical expression trees and 2D box formulas, and how convrtr translates them to clean GitHub Flavored Markdown.
Converting LyX Documents to Markdown: Preserving Academic Math and Outlines
Learn how LyX WYSIWYM documents are structured. Explore how layout trees, mathematical formula insets, and tabular matrices convert into GitHub Flavored Markdown.
Converting GNU Texinfo to Markdown: Modernizing Free Software Manuals
Discover GNU Texinfo, the documentation language behind GCC and Emacs. Learn how single-source @-directives convert cleanly into GitHub Flavored Markdown.
Converting Unix Man Pages to Markdown: Modernizing Terminal Documentation
Transform vintage and modern Unix roff and BSD mdoc manual pages into clean GitHub Flavored Markdown. Learn how macro packages convert to web-ready documentation.
Converting AT&T Troff Documents to Markdown: Classical Unix Typesetting
Discover classical AT&T troff (.tr / .troff) typesetting documents from Bell Labs. Learn how dot requests, string registers, and macros translate to GFM Markdown.