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.
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

files

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

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

output

std::filesystem::path output

Output directory.

Function Details

MarkdownGenerator

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

Constructor.

output
Output directory.

brief

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

Produce brief description for an entity.

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.

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().

color

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

Lookup color for given percentage.

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.

frontmatter

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

Produce the YAML frontmatter for an entity.

generate

void generate(const Entity& root, const bool cov)

Generate documentation.

root
Root entity.
cov
Include code coverage report?

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

Recursively generate documentation.

output
Output directory.
entity
Entity for which to generate documentation.
cov
Include code coverage report?

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.

icon

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

Lookup icon for given percentage.

indent

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

Indent lines.

line

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

Reduce to a single line.

relative

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

Produce a relative path.

sanitize

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

Sanitize for a file name or internal anchor.

stringify

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

Sanitize for a string, escaping double quotes and backslashes.

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.

title

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

Produce title for an entity.

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?