Skip to content

MarkdownGenerator

class MarkdownGenerator

Markdown generator.

Variables

Name Description
output Output directory.
files Set of files generated during the last call to generate().

Functions

Name Description
MarkdownGenerator Constructor.
generate Generate documentation.
coverage Generate coverage.
clean Clean up after generation, removing files from old runs.
generate Recursively generate documentation.
coverage Recursively generate coverage.
coverage_data Recursively generate coverage table data.
coverage_foot Recursively generate coverage table footer.
sunburst Produce sunburst chart of code coverage for entity.
sunburst_data Produce data for sunburst chart of code coverage for entity.
relative Produce a relative path.
can_write Can the file be written?
frontmatter Produce the YAML frontmatter for an entity.
title Produce title for an entity.
brief Produce brief description for an entity.
line Reduce to a single line.
indent Indent lines.
stringify Sanitize for a string, escaping double quotes and backslashes.
htmlize Sanitize for HTML, replacing special characters with entities.
sanitize Sanitize for a file name or internal anchor.
color Lookup color for given percentage.
icon Lookup icon for given percentage.
view Convert a list of entities to a list of pointers to entities, optionally sorting by name.

Variable Details

output

std::filesystem::path output

Output directory.

files

std::unordered_set<std::filesystem::path> files

Set of files generated during the last call to generate().

Function Details

MarkdownGenerator

MarkdownGenerator(const std::filesystem::path& output)

Constructor.

output
Output directory.

generate

void generate(const Entity& root)

Generate documentation.

root
Root entity.

coverage

void coverage(const Entity& root)

Generate coverage.

root
Root entity.

clean

void clean()

Clean up after generation, removing files from old runs. Traverses the output directory, removing any Markdown files with 'generator: doxide' in their YAML frontmatter that were not generated by previous calls of generate().

generate

void generate(const std::filesystem::path& output, const Entity& entity)

Recursively generate documentation.

output
Output directory.
entity
Entity for which to generate documentation.

coverage

void coverage(const std::filesystem::path& output, const Entity& entity)

Recursively generate coverage.

output
Output directory.
entity
Entity for which to generate coverage.

coverage_data

static void coverage_data(const Entity& entity, const Entity& root, std::ofstream& out)

Recursively generate coverage table data.

entity
Entity for which to generate coverage.
root
Root entity for the current page. This is used to determine which are rows should be visible initially.
out
Output stream.

coverage_foot

static void coverage_foot(const Entity& entity, const Entity& root, std::ofstream& out)

Recursively generate coverage table footer.

entity
Entity for which to generate coverage.
root
Root entity for the current page. This is used to determine which are rows should be visible initially.
out
Output stream.

sunburst

static void sunburst(const Entity& entity, const Entity& root, std::ofstream& out)

Produce sunburst chart of code coverage for entity.

entity
Entity for which to generate sunburst.
root
Root entity for the current page. This is used to determine paths relative to the root.
out
Output stream.

sunburst_data

static void sunburst_data(const Entity& entity, const Entity& root, std::ofstream& out)

Produce data for sunburst chart of code coverage for entity.

entity
Entity for which to generate sunburst.
root
Root entity for the current page. This is used to determine paths relative to the root.
out
Output stream.

relative

static std::string relative(const std::filesystem::path& path, const std::filesystem::path& base)

Produce a relative path.

can_write

static bool can_write(const std::filesystem::path& path)

Can the file be written? To be overwritten, the file must either not exist, or exists but has 'generator: doxide' in its YAML frontmatter.

frontmatter

static std::string frontmatter(const Entity& entity)

Produce the YAML frontmatter for an entity.

title

static std::string title(const Entity& entity)

Produce title for an entity.

brief

static std::string brief(const Entity& entity)

Produce brief description for an entity.

line

static std::string line(const std::string& str)

Reduce to a single line.

indent

static std::string indent(const std::string& str)

Indent lines.

stringify

static std::string stringify(const std::string& str)

Sanitize for a string, escaping double quotes and backslashes.

htmlize

static std::string htmlize(const std::string& str)

Sanitize for HTML, replacing special characters with entities. Also replaces some characters that might trigger Markdown formatting.

sanitize

static std::string sanitize(const std::string& str)

Sanitize for a file name or internal anchor.

color

static const std::string& color(const double percent)

Lookup color for given percentage.

icon

static const std::string& icon(const double percent)

Lookup icon for given percentage.

view

static std::list<const Entity*> view(const std::list<Entity>& entities, const bool sort)

Convert a list of entities to a list of pointers to entities, optionally sorting by name.

entities
List of entities.
sort
Sort by name?