File Exchange

image thumbnail

Prettify MATLAB html

version 6.4 (1.3 MB) by Harry Dymond
Provides additional features when exporting .m files to html using MATLAB's "publish" feature


Updated 18 Oct 2020

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

prettify_MATLAB_html gives you additional features when publishing an .m file to html using MATLAB's publish function:

1. With a few easy-to-use "tags" in your source .m file, you can:
— Create collapsible sections, similar to those seen in "official" MATLAB help pages.
— Create internal page links to jump to other parts of the page.
— Insert line breaks.
— Insert spacing of specified pixel height.
— Specify size for any text.
— Specify colour for any text.
— Insert your own CSS classes to style text however you wish.
— Optionally, give the user a choice to display the page with a “dark” theme.
— Easily switch between elements in the page according to which theme (“light” or “dark”) is selected by the user.

2. Provides Quick-Access Toolbar buttons to insert the prettify_MATLAB_html tags when editing your .m file.

3. Provides a built-in table style to use when embedding an html table.

4. Automatically ensures that images do not exceed page width (images that would be wider than the page at their full size, scale with the width of the page).

5. Gives inline code and execution results a horizontal scroll bar if they do not fit in the width of the page.

Please see the examples tab above for a full description of prettify_MATLAB_html's usage and features.

Cite As

Harry Dymond (2020). Prettify MATLAB html (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Harry Dymond

Hi Arthur Henry,
Thanks for your review! Please could you contact me directly via email (my address is in the header of the prettify_MATLAB_html.m file) so we can discuss your query?

Arthur Henry

Wonderful work!
This could use a function to inline generated images as base64 and have self-contained reports? Is this feasible?

per isakson

Hi Harry Dymond,
Thank you for the swift fix and upload of version 4.2. I made some test under R2018b/Win10. The problems are gone. Now expand and collapse works as advertised.

Harry Dymond

Hi per isakson,
Thank you for the review and for reporting that issue. I believe that the problem is fixed in version 4.2

per isakson

When there exists a file, info.xml, web('name.html','-new') displays the html-file in the Matlab Help browser. (This is a poorly documented feature or a bug.)

The Matlab Help browser doesn't respond neither to "expand/collapse all on page" nor to "expand/collapse all".

This shortcoming will most likely affect the use of Prettify MATLAB html to create Custom Documentation.

P.S. I tested with Prettify MATLAB html version 4.1

Harry Dymond

Hi Scott, thanks for the review.

In answer to your question, yes, it is possible to collapse a [dtls] box by default. I’ve updated the documentation; please see the “Advanced Usage” section.

Scott Miller

Great submission! I am in the middle of putting together comprehensive documentation for a tool, and the expanded Publish features that this package provides are quite useful.

The [dtls] tag expands the enclosed section by default. I'd like to create a page such that the enclosed section is collapsed by default. Is this possible?


MATLAB Release Compatibility
Created with R2018a
Compatible with R2016b to R2020a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

publish overload

prettify documentation