Convert godot xml docs to docfx yml
Project description
Godot Doc 2 Yml
Convert godot xml docs exported via the godot --doctool for gdscript
to yml compatible with docfx.
Install
Install gddoc2yml via pip
python3 -m pip install gddoc2yml
Then you will have the gdxml2yml and gdxml2xrefmap command available:
gdxml2yml -h
usage: gdxml2yml [-h] --path PATH [PATH ...] [--filter FILTER [FILTER ...]] --output OUTPUT
Convert godot documentation xml file to yml for docfx.
options:
-h, --help show this help message and exit
--path PATH [PATH ...]
A path to an XML file or a directory containing XML files to parse.
--filter FILTER [FILTER ...]
Regex filepath patterns for XML files to filter.
--output OUTPUT Output folder to store all generated yml files.
gdxml2xrefmap -h
usage: gdxml2xrefmap [-h] [--path PATH [PATH ...]] [--filter FILTER [FILTER ...]] [--output OUTPUT]
Convert godot documentation xml files into a xrefmap compatible with DoxFx.
options:
-h, --help show this help message and exit
--path PATH [PATH ...]
A path to an XML file or a directory containing XML files to parse.
--filter FILTER [FILTER ...]
Regex filepath patterns for XML files to filter.
--output OUTPUT output path to store xrefmap.
Using gddoc2yml
Export xml docs for your project with godot, us gdxml2yml to generate yml api, then use the gd
-
Generate xml docs for your project.
Install godot command line tool (see Godot's Command Line Tutorial for details).
Export docs for your gdscript to xml via the
--doctoolflag.# Example command to generate docs from scripts in project/scripts to dir doc/my-classes godot --path project --doctool doc/my-classes --gdscript-docs res://scripts
-
Use gdxml2yml to generate yml docs for your project. See references section for details on yml schema.
# You will also need the original xml docs from # the godot repo, generate via godot --doctool <path> # to generate godot docs at a given path # $ mkdir ref # $ godot --doctool ref # Generate yml api for docfx. # Generates output at folder out/my-classes/api # Use the '--filter' flag to only generate docs for your files gdxml2yml --filter doc/my-classes --path doc/my-classes ref --output out/my-classes/api
-
Use your generated yml in docfx. see the doc/docfx.json for an example. Make sure to include your api folder in the doc content
{ "files": ["*.yml"], "src": "api", "dest": "api" },
Generating xrefmap for Godot Docs
Included is an additional command, gdxml2xrefmap to generate
an xrefmap for the godot docs.
gdxml2xrefmap --path godot/doc/classes godot/modules --output out/godot_xrefmap.yml
Note the build for this repo contains an xrefmap that points to godot's
documentation. You can reference this in your docfx.json file as a xref
like so:
{
"build": {
"xref": [
"https://gddoc2yml.nickmaltbie.com/xrefmap/godot_xrefmap.yml"
]
}
}
References
- Godot -- CLI Reference
- Godot -- make_rst.py
- DocFx -- Github
- DocFx -- Introduction to Multiple Languages Support
- DocFx -- Custom Template
- DocFx -- .NET API Docs YAML Format
- DocFx -- PageViewModel.cs
- DocFx -- ItemViewModel.cs
- DocFx -- Recommended XML tags for C#
Development
This section consists of how to build and test the gddoc2yml project.
Setup
Build package
# Install dependencies
python3 -m pip install -r requirements.txt
# Install build if required
# python3 -m pip install build
# Project will be created in dir dist
python3 -m build
Linting
Lint using flake8 tool.
# Run flake8 from .flake8 config file
# Install via python3 -m pip install flake8
python3 -m flake8 .
Markdown Linting
Markdown linting via markdownlint can be installed via npm.
# Install cli version via npm
npm install -g markdownlint-cli
# Run on local repo
markdownlint .
Tests
Run tests for project via Python's unittest module -- Unit testing framework
python3 -m unittest
Code Coverage
Compute code coverage using coveragepy
# Get code coverage using coverage
# Install via python -m pip install coverage
coverage run -m unittest discover
# Get results
coverage report -m
Build and Use Latest Version
Build godot docs using latest gddoc2yml.
# Download submodules
git submodule update --init godot
# Install from repo
python3 -m pip install .
# Generate docs using gdxml2yml
gdxml2yml --path godot/doc/classes godot/modules godot/platform/android/doc_classes --output doc/godot/api
# Generate xrefmap using gdxml2xrefmap
gdxml2xrefmap --path godot/doc/classes godot/modules doc/xrefmap/godot_xrefmap.yml
# Startup docfx website
dotnet tool run docfx --serve doc/docfx.json
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gddoc2yml-1.0.0.tar.gz.
File metadata
- Download URL: gddoc2yml-1.0.0.tar.gz
- Upload date:
- Size: 48.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c16af1fdda2d860958e551d6747aaf86cb3c6565dfec151fb9e95afd940872
|
|
| MD5 |
43574fe71e3f2d5418dab074d6df5294
|
|
| BLAKE2b-256 |
4a856aebf7b9fd3431122f715790c5a244301cf02e97713885b37006d43f6a87
|
Provenance
The following attestation bundles were made for gddoc2yml-1.0.0.tar.gz:
Publisher:
on-release.yml on nicholas-maltbie/gddoc2yml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gddoc2yml-1.0.0.tar.gz -
Subject digest:
c8c16af1fdda2d860958e551d6747aaf86cb3c6565dfec151fb9e95afd940872 - Sigstore transparency entry: 189229245
- Sigstore integration time:
-
Permalink:
nicholas-maltbie/gddoc2yml@025250dd03a564be50bd73bc1084cb73318c30e5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/nicholas-maltbie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release.yml@025250dd03a564be50bd73bc1084cb73318c30e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gddoc2yml-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gddoc2yml-1.0.0-py3-none-any.whl
- Upload date:
- Size: 43.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6183b76c3b032f21b60df52e31f0fa35a235463743ce48745a65187c8a7c10b9
|
|
| MD5 |
6796282a2774bc0f6f27090d04111942
|
|
| BLAKE2b-256 |
dcd0963fea06aaad3a3254f226b6884a45293dbe7cfad4d4c30b4ad8ca989dfd
|
Provenance
The following attestation bundles were made for gddoc2yml-1.0.0-py3-none-any.whl:
Publisher:
on-release.yml on nicholas-maltbie/gddoc2yml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gddoc2yml-1.0.0-py3-none-any.whl -
Subject digest:
6183b76c3b032f21b60df52e31f0fa35a235463743ce48745a65187c8a7c10b9 - Sigstore transparency entry: 189229246
- Sigstore integration time:
-
Permalink:
nicholas-maltbie/gddoc2yml@025250dd03a564be50bd73bc1084cb73318c30e5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/nicholas-maltbie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release.yml@025250dd03a564be50bd73bc1084cb73318c30e5 -
Trigger Event:
push
-
Statement type: