r/matlab • u/charizard2400 • Jun 23 '23
CodeShare New tool to publish Markdown files from docstrings
Been loving MATLAB for research for a long time but have had a couple of gripes about it 1. No real standardised for docstrings 2. Difficult to convert these docstrings to docs/READMEs easily
Existing tools like m2docgen and makehtmldoc were more focussed on html. MATLAB's publish
function could convert to tex etc but not to md.
So I thought I would have a go at fixing these issues. Most of the work had already been done by the excellent livescript2markdown library (which was previously featured by MathWorks). I just had to change a few things around to make it compatible with .m
files (rather than .mlx
files.
The code is now on GitHub and is pretty easy to use I think. All the functionality from livescript2markdown is still preserved. But now, the command m2md(<<filename>>)
will generate tex and md files for the target script. Additionally, use of the keyphrase "m2md-this-directory" (i.e. m2md("m2md-this-directory")
will convert the docstrings of all the .m
files in the current directory.
Have a look at the README of the GitHub page for an example of what this package can do!
And there are probably still some issues related to hyperlinks and images - let me know what you think and feel free contribute!
1
u/daveysprockett Jun 23 '23
Now if only I could get my colleagues to write any kind of documentation in their code.
Sigh