minetest-mods / 3d_armor

Visible player armor & wielded items for minetest
Other
17 stars 39 forks source link

API Docs Generation Examples with LDoc & MkDocs #54

Closed AntumDeluge closed 3 years ago

AntumDeluge commented 3 years ago

As per https://github.com/minetest-mods/3d_armor/pull/51#issuecomment-867321886, I created a couple examples for documenting 3d_armor API with LDoc & MkDocs. The documentation is created as an example so is not complete. Keep in mind that I am new to using MkDocs, so it could probably look a lot nicer as is done with Minetest's API.

Examples:

BuckarooBanzay commented 3 years ago

so, from what i can tell: the mkdocs variant is built from separate markdown files. Isn't it better to keep documentation in-line (and as near as possible) with the code like in the ldoc example? :thinking:

AntumDeluge commented 3 years ago

In the examples I provided, they are actually both built from a separate file (see: source file). However, yes, LDoc can parse Lua docstrings from source code which MkDocs cannot do (as far as I understand). Currently, 3d_armor is not using any Lua docstrings that I am aware of (except in the armor.set_skin_mod method). So if we use LDoc, we can either use an external file (like in my example), or we can just add docstrings to the code.

AntumDeluge commented 3 years ago

I believe that Doxygen has Lua support, or a third party module for Lua support. But LDoc is simpler IMO.

My opinion (with limited knowledge) of the following:

If you want to do in-line documentation, I would recommend using LDoc or Doxygen (though I am not 100% sure Doxygen has Lua support). If you want to use a separate file for HTML generation and plain-text readabiltity, I would probably suggest MkDocs. MkDocs just uses a markdown formatted file for generating HTML docs. LDoc supports markdown within Lua docstrings.

SmallJoker commented 3 years ago

Oh. I did not see this issue. I only check PRs every now and then. LDoc seems to be more promising, it even has simple markdown support, which would be great to generate a file for easy lookup online.

AntumDeluge commented 3 years ago

@SmallJoker Which would you prefer: Adding Lua docstrings to the code or using a separate file?

SmallJoker commented 3 years ago

No idea.

@BuckarooBanzay Which would you prefer: Adding Lua docstrings to the code or using a separate file?

BuckarooBanzay commented 3 years ago

@BuckarooBanzay Which would you prefer: Adding Lua docstrings to the code or using a separate file?

As mentioned above: my money would be on inline-docs, on the code itself

AntumDeluge commented 3 years ago

I usually prefer inline as well.

AntumDeluge commented 3 years ago

When I get a chance, I will write up some documentation & submit a PR for review.

AntumDeluge commented 3 years ago

Started WIP pull request: #58