Unreal Doc

Tool for generating documentation from Unreal C++ sources.

Table of contents

  1. About
  2. Installation
  3. Config file
    1. Simple config setup for baking into JSON portable format
    2. Simple config setup for baking into MD Book
    3. Advanced config setup for baking into MD Book
  4. Markdown doc comments
  5. Markdown book pages
  6. Run documentation baking command
  7. Examples

About

Do you create an Unreal Engine plugin and need to generate a documentation combined with book for it, but Doxygen seems limited or sometimes not working at all?

Fear not - this tool understands Unreal C++ header files syntax and Markdown doc comments, it can also bake a book pages out of Markdown files, all of that being able to cross-reference each other!

Installation

Config file

Config TOML file tells this tool evenrythig about how to build documentation for your project. At this moment there are two baking backends available: - Json

Portable representation of documentation and book that can be used in third party
applications with custom way of baking documentation.

Although config file can be named whatever you want, it's a good rule to give config file UnrealDoc.toml name.

Simple config setup for baking into JSON portable format

toml input_dirs = ["./source"] output_dir = "./docs"

Simple config setup for baking into MD Book

```toml inputdirs = ["./source"] outputdir = "./docs" backend = "MdBook"

[backend_mdbook] title = "Documentation" build = true cleanup = true ```

Advanced config setup for baking into MD Book

```toml inputdirs = ["./source"] outputdir = "./docs" backend = "MdBook"

[settings] documentprivate = true documentprotected = true show_all = true

[backend_mdbook] title = "Documentation" build = true cleanup = true header = "header.md" footer = "footer.md" assets = "assets/" ```

Markdown doc comments

Overview of all possible things you can do with Markdown doc comments. ```c++

pragma once

using Foo = std::vector;

enum class Something : uint8;

template struct BAR Foo : public Bar;

class FOO Bar;

template void* Main(const Foo& Arg);

/// Description of enum /// /// More information and examples. UENUM(BlueprintType, Meta = (Foo = Bar)) enum class Something : uint8 { A, B };

/// Description of struct /// /// More information and examples. /// /// struct: Self::Foo /// struct: Self::A USTRUCT(BlueprintType, Meta = (Foo = Bar)) template struct BAR Foo : public Bar { protected: /// What is this method /// /// What it does UFUNCTION() virtual void Foo( /// Argument int A, /// Argument with default value AActor* B = nullptr) const override;

private: /// What is this property /// /// What impact does it have UPROPERTY() int A[] = {0}; };

/// Description of class /// /// More information and examples. /// /// class: Self::Bar UCLASS() class FOO Bar { public: /// What is this method /// /// What it does Bar(); };

/// What is this function /// /// What does it do /// /// function: Self /// /// See: /// - enum: Something /// - struct: Foo /// - struct: Foo::Foo /// - struct: Foo::A /// - class: Bar /// - function: Main /// /// # Examples /// snippet /// hello_world /// /// snippet /// hello_world2 /// /// snippet /// wait_what /// template void* Main( /// Some referenced data const Foo& Arg) { //// [snippet: hello_world] if (true) { printf("Hello"); } //// [/snippet]

//// [snippet: hello_world2]
printf("World");
//// [/snippet]

}

//// [snippet: wait_what] struct Wait { int What = 0; }; //// [/snippet]

/// Proxy documentation for injecting code with macros. /// //// [proxy: injectable] //// void Injected() const; //// [/proxy] #define INJECT \ void Injected() const \ { \ }

struct Who { int What = 0;

void SetWhat(int InWhat)
{
    //// [ignore]
    this->What = InWhat;
    //// [/ignore]
}

/// Operator overload.
friend bool operator==(const Who& Lhs, const Who& Rhs)
{
    //// [ignore]
    return Lhs.What == Rhs.What;
    //// [/ignore]
}

//// [inject: injectable]
INJECT

}; ```

Markdown book pages

Standard expected structure of the book Markdown files:

Run documentation baking command

Once you have config file and documentation itself all in place, it's time to actually bake documentation and book bundle:

bash unreal-doc -i path/to/UnrealDoc.toml

Example

If you want to see an example of decoumentation and book source files structure, take a look at /resources directory in this repository or more real life example that can be found here: https://github.com/PsichiX/Unreal-Systems-Architecture/tree/master/Plugins/Systems/Documentation

Real life example of baked plugin documentation: https://psichix.github.io/Unreal-Systems-Architecture/systems