From 52bf53d34133307515a4b0a093469dadd7b5ef10 Mon Sep 17 00:00:00 2001 From: Ludovic Dussart Date: Fri, 29 Jan 2021 18:46:12 +0100 Subject: [PATCH] feat: display correlationId to the rendered html Close #108 --- README.md | 5 +++++ package.json | 4 +++- partials/message.html | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 55d1961fc..4df8612d6 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,11 @@ npm install -g @asyncapi/generator 1. Adjust styling and generate `tailwind.min.css` with `npm run generate:assets` 1. Generate output with watcher enabled: `npm run develop`. + + >**NOTE:** If your changes are not visible, this is maybe because the `ag` use the already installed `html-template` so you should use the `--install` option + > * run `npm run develop:install` + > * if command failed, delete the cached `html-template` module in your system and re-rerun the command + 1. Open HTML in your browser: `open ./test/output/index.html`. ## Contributors ✨ diff --git a/package.json b/package.json index 90a60a812..7ca47d7df 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,9 @@ "lint": "echo \"No linter specified yet\"", "test": "ava", "release": "semantic-release", - "develop": "ag https://raw.githubusercontent.com/asyncapi/generator/v1.0.0/test/docs/dummy.yml ./ -o test/output --force-write --watch-template", + "develop": "ag https://raw.githubusercontent.com/asyncapi/generator/v1.1.5/test/docs/dummy.yml ./ -o test/output --force-write --watch-template", + "//develop:install": "Force ag to install your local html-template source code", + "develop:install": " npm run develop -- --install", "generate:assets": "cross-env NODE_ENV=production postcss template/css/main.css -o template/css/tailwind.min.css", "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" }, diff --git a/partials/message.html b/partials/message.html index 4c559cfbb..301b057d9 100644 --- a/partials/message.html +++ b/partials/message.html @@ -19,6 +19,18 @@ {{ tags(msg.tags()) }} + {% set correlationId = msg.correlationId() %} + {% if correlationId %} +
+
Correlation ID{{correlationId.location()}} + +
+ {% if correlationId.hasDescription() %} +
{{correlationId.description() | markdown2html | safe }}
+ {% endif %} +
+ {% endif %} +
{{ msg.description() | markdown2html | safe }}
{% if msg.payload() %} {{ schema(msg.payload(), 'Payload', open=open) }}