Skip to main content

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 command available:

gdxml2yml
    usage: gdxml2yml [-h] [--filter FILTER] path [path ...] output
    gdxml2yml: error: the following arguments are required: path, output

gdxml2yml -h
    usage: gdxml2yml [-h] [--filter FILTER] path [path ...] output

    Convert godot documentation xml file to yml for docfx.

    positional arguments:
    path             A path to an XML file or a directory containing XML files to parse.
    output           output folder to store all generated yml files.

    options:
    -h, --help       show this help message and exit
    --filter FILTER  The filepath pattern for XML files to filter

Using gddoc2yml

Export xml docs for your project with godot, us gdxml2yml to generate yml api, then use the gd

  1. 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 --doctool flag.

    # 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
    
  2. 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 doc/my-classes ref out/my-classes/api
    
  3. 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"
    },
    

References

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.

# Install from repo
python3 -m pip install .

# Generate docs using gdxml2yml
gdxml2yml godot/doc/classes godot/modules godot/platform/android/doc_classes doc/api

# 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

gddoc2yml-0.1.1.tar.gz (79.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gddoc2yml-0.1.1-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

File details

Details for the file gddoc2yml-0.1.1.tar.gz.

File metadata

  • Download URL: gddoc2yml-0.1.1.tar.gz
  • Upload date:
  • Size: 79.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for gddoc2yml-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6c9ae995bbf38daf030bd805c4b6122b1398b907d9de51040ce710fc925ccd5
MD5 10eee6a2741d34fdfe0ac0c893d4d1d2
BLAKE2b-256 60d249048afbc49cd7b690c50316cb63f90fe04c5ab414cb7d4392a4d50a992c

See more details on using hashes here.

File details

Details for the file gddoc2yml-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gddoc2yml-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for gddoc2yml-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cdd70e1bc44dcd0fa6a2c1becc0921741d9d4f3556bd0927768b922e8ca43f3
MD5 c67e97221d2e7d9fd4e1cfed80610652
BLAKE2b-256 275abc3e6d73b67e99ce6beea0911e732b2459faf391ff493989b5e247af10eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page