Blog

DocBox 3.0 Released

Michael Born March 15, 2021

Spread the word

Michael Born

March 15, 2021

Spread the word


Share your thoughts

DocBox

Say hello to DocBox 3.0! This new version adds JSON output format, multiple strategy support, and a raft of improvements across the board. Check it out by running box install docbox@3 to install the new version.

What Is DocBox?

DocBox is a CFML library that converts CFML component metadata and comment blocks into documentation. You can choose from three documentation formats - HTML, JSON, or an XMI file for generating UML diagrams - and generate docs from the CommandBox CLI or from your application.

In other words, DocBox takes you from code comments to delicious documentation in a matter of minutes.

Why Is DocBox?

DocBox exists to fill the gap between hand-written documentation (such as coldbox.ortusbooks.com ) and no documentation whatsoever. DocBox is especially handy for public libraries, as it makes it simple for consumers to see the available classes and method signatures without needing to manually read or search the source code.

Installing DocBox

There are two main ways to generate app documentation using DocBox:

  1. From the CommandBox CLI, with DocBox Commands
  2. From your CFML app, with the DocBox library

From CommandBox

To use DocBox within CommandBox, you'll want to run install commandbox-docbox and follow that with docbox help to see the available commands and syntax.

Just as an example, here's a typical command to generate documentation for a Coldbox application:

docbox generate source=./ mapping=app excludes=tests|coldbox|testbox|modules strategy-outputDir=./tmp strategy-projectTitle=""

For more examples and documentation, check out the DocBox Commands project on Forgebox.

From Your CFML App

For generating documentation from your CFML application, run install docbox within Commandbox to install the docbox library.

Now you can create a CFML file to instantiate the Docbox class, configure a few settings, and run the documentation generator:

new docbox.DocBox( "HTML", {
        projectTitle : "CommandBox",
        outputDir : expandPath( './docs' )
    } )
    .generate(
       source = expandPath( "/app" ),
       mapping = "app",
       excludes="(coldbox)"
    );

Check out the Docbox documentation for configuration help.

CFCasts Series

Are you interested in using DocBox for your projects? We are working on a "Using DocBox" CFCasts series for those devs who need a bit more help getting started. If you like the idea of automated documentation but don't know where to start, you'll love this new series on CFCasts. Using DocBox will be available in the coming weeks.

Release Notes

3.0.0

Added

  • New json output strategy for machine-readable documentation.
  • New addStrategy() method for generating multiple documentation formats simultaneously.
  • New documentation site hosted at docbox.ortusbooks.com
  • New TestBox suite of tests ensuring CF2018, CF2016 and Lucee compatibility on every output strategy.

Changed

  • Can configure strategy with "alias" name, like strategy="HTML".

Removed

  • Removed HTML as the default strategy. You will need to explicitly pass this to the constructor or to docbox.addStrategy( "HTML", props ) to set your desired output format.

Add Your Comment

Recent Entries

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Unfortunately, we often hear this message from clients who thought it would never happen to them... until it did. Some believed they could delay the expense of Implementing ColdFusion security best practices for one year, while others were tempted to put it off for just a few months. However, in today's rapidly evolving digital landscape, the security of web applications, including ColdFusio...

Cristobal Escobar
Cristobal Escobar
April 16, 2024
Ortus March Newsletter

Ortus March Newsletter

Welcome to Ortus Solutions’ monthly roundup, where we're thrilled to showcase cutting-edge advancements, product updates, and exciting events! Join us as we delve into the latest innovations shaping the future of technology.

Maria Jose Herrera
Maria Jose Herrera
April 01, 2024
Into the Box 2024 Last Early Bird Days!

Into the Box 2024 Last Early Bird Days!

Time is ticking, with less than 60 days remaining until the excitement of Into the Box 2024 unfolds! Don't let this golden opportunity slip away; our exclusive Early Bird Pricing is here for a limited time only, available until March 31st. Why wait? Secure your seat now and take advantage of this steal!

Maria Jose Herrera
Maria Jose Herrera
March 20, 2024