BodyFormat.h header

#include <ew/core/BodyFormat.h>

Namespace ew::core

Enumerations

enum class BodyFormat { Markdown, Html }

How a document body is stored on disk. Markdown is the default and the target format – diff-friendly Markdown with the app's rich-text extension (DESIGN.md section 6.1/6.3). Html is a legacy body the editor stored as rich-text HTML that has not (yet) been losslessly migrated to Markdown; it is kept verbatim so no formatting is ever dropped, and migration is re-attempted on each load (a converter improvement can then migrate it). New documents are Markdown. Serialized as a stable lowercase token.

Functions

std::optional< BodyFormat > ew::core::bodyFormatFromToken(QStringView token)

Parses a body format from its serialization token; std::nullopt if unrecognized or absent (a legacy document with no tag, which the loader treats as a body to attempt to migrate).

QString ew::core::toToken(BodyFormat format)

Returns the stable serialization token for format ("markdown" / "html").