cesarParra / apexdocs

Node.js tool to generate documentation for your Salesforce Apex Classes.
https://www.npmjs.com/package/@cparra/apexdocs
MIT License
109 stars 18 forks source link

Mermaid support. #108

Closed cesarParra closed 7 months ago

cesarParra commented 7 months ago

Add support for inline diagraming through Mermaid.

The new @mermaid tag can be used to describe Mermaid diagrams through code. It works similarly to how @example works, where the code gets placed in individual lines after defining the tag.

Example:

/**
 * @description My Class' description
 * @mermaid
 * sequenceDiagram
 *    participant dotcom
 *    participant iframe
 *    participant viewscreen
 *    dotcom->>iframe: loads html w/ iframe url
 *    iframe->>viewscreen: request template
 *    viewscreen->>iframe: html & javascript
 *    iframe->>dotcom: iframe ready
 *    dotcom->>iframe: set mermaid data on iframe
 *    iframe->>iframe: render mermaid
 */
public class MyClass {
}

The diagram displays as

image

Note that to be able to make use of this feature you need to use a Markdown reader that supports rendering Mermaid (for example, Github's markdown reader has it built-into it).