Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Markdown Parser for Inline CALM Document Rendering #782

Open
LeighFinegold opened this issue Jan 10, 2025 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@LeighFinegold
Copy link
Member

LeighFinegold commented Jan 10, 2025

Feature Request: Markdown Parser for Inline CALM Document Rendering

Description

We propose adding a Markdown (MD) parser to the Architecture as Code project that can render CALM documents inline. This feature would enhance the readability and usability of CALM documents by enabling users to embed and visualize the architecture as part of their documentation workflow.

Use Case

The CALM (Concepts, Attributes, Links, and Metrics) specification is central to this project, and many users document their architecture alongside other markdown content. With this feature, CALM documents could be visualized directly within markdown files, eliminating the need for external tools to interpret the JSON or YAML representations.

For example:

```calm
{
  "id": "exampleFlow",
  "name": "Account Information Flow",
  "description": "Handles updates to account data in the database.",
  "transitions": [
    { "relationshipId": "rel1", "sequence": 1 },
    { "relationshipId": "rel2", "sequence": 2 }
  ],
  "controls": ["auth-check", "audit-log"]
}

Alternatively, a CALM document can be referenced directly from the file system

```calm
file://./calm-docs/exampleFlow.json

Would render the document from file

Proposed Features

  1. MD Parser:
  2. Plugin Support:
    • Enable optional plugins to customize visualization styles and outputs.
  3. Output Formats:
    • Default to SVG or PNG diagrams for rendered output.

Benefits

  • Streamlines the workflow by combining documentation and architecture in a single format.
  • Makes CALM documents easier to consume by technical and non-technical stakeholders.
  • Reduces the friction in generating diagrams or understanding the architecture.

Technical Considerations

  1. Use an existing MD parser library (e.g., Markdown-it) to extend markdown parsing functionality.
  2. Leverage libraries such as Mermaid or PlantUML for rendering diagrams.
  3. Ensure support for various CALM document schemas to accommodate diverse use cases.
  4. Consider performance impacts for large CALM documents embedded in markdown.

Potential Challenges

  • Ensuring the parser handles invalid or partial CALM documents gracefully.
  • Maintaining consistent rendering fidelity between inline markdown and standalone diagram generation tools.

Next Steps

  1. Gather feedback on this proposal from the community. Its possible expectation here is we choose selected parsers that exist e.g. mermaid. https://github.com/LeighFinegold/architecture-as-code/blob/calm-docify/docify/traderx-sad.md
  2. Prototype an initial parser using Markdown-it or a similar library.
  3. Integrate with the current visualization tools in the project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant