Moonreader - Yet another documentation generator

Moonreader

Totally original name. Yet another documentation generator for Studio. See alternatives for other options that are available.

Asset Link: https://create.roblox.com/store/asset/16621522261
Repository Link: https://github.com/PhantomShift/moonreader

Inspired by Moonwave, Moonreader is a similar tool that generates documentation from the comments within your source code. The aim is to be a supplementary tool for those who work in both Studio and external editors a lot, and can also serve as a sort of “preview” for any documentation you plan on generating through Moonwave, though you can also just use Moonreader by itself if it’s all you need.

Moonreader aims to be generally compliant with Moonwave’s commenting syntax and support most (if not all) of its tags. See src/Parser.lua for the general state of how many tags are implemented.

Usage

For a general overview of the valid syntax for doc comments, take a look at Moonwave and its documentation.

Moonreader will automatically generate documentation from all of the source containers in the place by default. This documentation can be viewed by selecting “Open Docs” from Moonreader’s plugin toolbar.

A smaller searchable version of the documentation containing only function definitions can be viewed by selecting “Quick Search”. Function definitions can be jumped to by clicking on the icon next to the function name.

As of now, the only setting to change is which paths to ignore, which can be viewed and edited by selecting “Open Settings”.

To regenerate the documentation, either after editing some source code or changing some settings, select “Generate Docs”.

There are bindable actions to open Quick Search and to search within the documentation itself. (File > Advanced > Customize Shortcuts...)

What’s with all the if game then require(...) else require("...")?

If at all possible, I’d like to keep the dependencies I’m writing “native luau compatible”,
meaning that they can work regardless of whether it’s in studio or in cli (like in a runner such as lune).
Realistically I probably won’t ever be using these outside of this plugin (except for maybe IterTools), but it has the big benefit of letting me test outside of studio (particularly with all the string manipulation that’s happening that doesn’t necessitate testing in Studio).

Acknowledgements

Moonreader is made possible by the brilliant projects and resources provided by these people

Alternatives

Screenshots

7 Likes

Update 3/12/24

Changes Since Initial Release

Fixed dashed comments (---) not being processed properly.

Added a button within the documentation viewer to open the search function (more convenient for those who don’t want to set the shortcut).

Case-sensitive search now works for searching in documentation.

Added ability to change some of the visual settings of the markdown processor.

The plugin has been updated to reflect these changes.

All changes since last update: Comparing ec50727...eefb122 · PhantomShift/moonreader · GitHub

4 Likes

Hi, I tried out the plugin and immediately get this error. I tested by opening different places and even an empty baseplate gets this:
image

Also noticed that I don’t see any other buttons, just this:
image

Any help? Was searching out a moonwave like plugin for Studio and got excited to see this, but I’m not sure what’s going wrong :sweat_smile:

Hey, sorry for the late reply, hadn’t been checking the forums.

That’s pretty weird, you reckon I could a list of the other plugins you use, if you don’t mind? Seems weird that there would be an issue in an empty baseplate, and I wasn’t able to replicate the issue so my guess is that there might be a script in a plugin or a script generated/added by a plugin (for example Rojo adds the promise library under PluginDebugService which I neglected to set as ignored by default) that happens to have an interface definition that breaks functionality.

Buttons are missing because they get created towards the end of the initialization script, which is interrupted by the docs failing to generate.

1 Like

Bit of further investigation, “invalid pattern capture” only occurs when a string pattern runs into the end capture character ) with no corresponding open capture (, so either there’s an interface definition where the field name contains a closing parenthesis like “Value)”, which while weird technically isn’t invalid, or the parsing is acting wonky such that it splits some strings such that a field name gets added with a closing parenthesis.

I’ll look into getting a release you could test where I do some manual string replacement with string.find with the plain setting instead of using string.gsub to get around any magic character nonsense.

1 Like

Yeah I don’t mind that at all, thanks man. Just been looking for documentation plugins that can show Moonwave formatted docs and don’t require setting up Rojo and stuff. I’ve ended up settling with this for now, but I still think Moonwave style docs look better haha

Changes in here should hopefully fix the issue, could you try adding this to your local plugins? Basically just implements the change I described.

MoonreaderDevelopment.rbxmx (323.7 KB)

I’ve built it as an rbxmx file so that you can inspect it before using.

Adding Local Plugins

Plugins directory can be accessed at C:\Users\username\AppData\Local\Roblox\Plugins or via Plugins > Plugins Folder in studio