Skip to content

shimming-toolbox/helpDocMd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

helpDocMd

functions to help extract .mbedded source doc; +export to .md

Overview

helpDocMd aims to provide an easy pipeline for publishing custom MATLAB® documentation:

  • particularly class-based API documentation

  • specifically as Markdown to be readily hosted online (1, 2, 3).

Getting started

Dependencies

  • MATLAB® Version R2019b or later.

Installation

  1. Clone this repository or download the source code.

  2. Start up Matlab and add the downloaded 'src' directory along with its subfolders to the path by typing

    addpath( genpath( '.../src/' )); which('Documentor')

    into the command prompt (replacing the ellipsis with the path to the downloaded folder). The filepath to Documentor.m should be displayed.

Basics

Printing

The first and most difficult step to publishing your source code documentation: Write it! (specifically, the header comment).

To publish it, the process is simple:

  1. Assemble the list of .m files and/or code-containing directories that you want to include as entries in a string vector: let's call it src. (By default, if src is a directory, it will be searched recursively for documentable .m files.)

  2. Initialize a Documentor object (e.g. one called Dr) with your list:

    Dr = Documentor( src ) ;  
  1. To print all of the documentation to Markdown text files, call:
    Dr.printdoc( ) ; 

Example

To print the documentation for the Documentor class itself:

   Dr = Documentor( which('Documentor') ) ;  
   Dr.printdoc( ) ;

If successful, the .md file path is displayed in the command window.

Once formated to HTML on GitHub, it looks like this.

FAQe

A fake FAQ:

What's wrong with the built-in help and doc commands?

Both are very useful, and the recently introduced Live Editor has great publishing features for scripts, but as of 2020(a) there still isn't any built-in functionality to export class documentation.

Why not use alternative software, like doxygen or sphinx?

There are advantages—simplicity, +potentially automating some of the documentation itself—to keeping the software and the commenting syntax "in-house"; particularly if we can assume that the built-in publishing features will eventually be extended to classes. (Albeit, the doc command already generates the—yet private—HTML that users have been requesting for years (4, 5) so who knows...)

References

  • Test a Markdown sample for how it will display once reformatted to HTML.

Re: hosting documentation online:

License

Same for parent repo: realtime_shimming

Releases

No releases published

Packages

No packages published

Languages