adrianvlupu / C4-Builder

This is a documentation builder. You feed it .md and .puml and it exports a site, pdf, or a markdown with navigation.
https://adrianvlupu.github.io/C4-Builder/
MIT License
562 stars 93 forks source link

Script tag execution and openapi rendering #63

Open vellala2000 opened 2 years ago

vellala2000 commented 2 years ago

closes #61

Supports script tag execution in MD file

Supports Swagger UI for openapi specs loading using html and script tag in MD file as below

<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta
    name="description"
    content="SwaggerIU"
  />
  <title>SwaggerUI</title>
  <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script>
  window.onload = () => {
    window.ui = SwaggerUIBundle({
      url: 'https://petstore3.swagger.io/api/v3/openapi.json',
      dom_id: '#swagger-ui',
    });
  };
</script>
</body>
</html>

image

vellala2000 commented 2 years ago

@adrianvlupu Please help review the changes and let me know if we need any adjustments as this is my time engaging in this project.

If all good please help merge these changes when you get a chance. Hope it will help incorporate API specs along with awesome plantuml C4design artifacts.

MickeJohannesson commented 2 years ago

@vellala2000 Have some questions around this one (I haven't tested it so)

And also a small comment: The option naming should be something like includeSwagger instead of executeScript because it only includes the JS link or not.

vellala2000 commented 2 years ago

@MickeJohannesson