Skip to content

A quick tool for converting LDoc dump output into Markdown ready for MkDocs

Notifications You must be signed in to change notification settings

Ozzypig/LDoc2MkDocs

Repository files navigation

LDoc2MkDocs

A Python package which converts LDoc output into Markdown ready for MkDocs

Requirements

You will need:

What's in the Box?

LDoc2MkDocs has two parts: Lua and Python. You'll need to use both in order to turn LDoc comments into Markdown.

Lua Module

The main Lua module is found in init.lua. It requires luajson and exposes the filter function which is to be provided to LDoc's --filter command line argument (you may have to configure your LUA_PATH environment variable for Lua to be able to find this). The purpose of this Lua module is fairly straightforward: it is provided LuaDoc's raw data as a table, strips unnecessary recursive table references and makes a few additions. Finally, it prints the result raw data as JSON. This "doc json" is then provided to the Python package.

This module is linted using selene (selene.toml).

Python Package

The other part of LDoc2MkDocs is the Python package. It uses Jinja 2 to render the Markdown template for each API member. The command line interface uses click.

Usage

Using --help will output the following:

$ python -m LDoc2MkDocs --help
Usage: __main__.py [OPTIONS] DOC_JSON_PATH OUT_PATH

  Convert a JSON file containing a dump of LDoc data into mkdocs-ready
  markdown files

Options:
  -p, --pretty  Should a prettified copy of the json file be output as well?
  --help        Show this message and exit.

Output

Once run, the resulting Markdown is placed in OUT_PATH (you might want to add some hand-written Markdown files to this directory). Then, invoke MkDocs on this directory to build your documentation!

About

A quick tool for converting LDoc dump output into Markdown ready for MkDocs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published