@redpanda-data/docs-extensions-and-macros 4.5.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.adoc +0 -163
  2. package/bin/doc-tools.js +492 -283
  3. package/cli-utils/antora-utils.js +127 -0
  4. package/cli-utils/generate-cluster-docs.sh +41 -29
  5. package/cli-utils/self-managed-docs-branch.js +2 -1
  6. package/cli-utils/start-cluster.sh +70 -30
  7. package/extensions/generate-rp-connect-info.js +14 -9
  8. package/package.json +6 -5
  9. package/tools/redpanda-connect/generate-rpcn-connector-docs.js +233 -0
  10. package/tools/redpanda-connect/helpers/advancedConfig.js +17 -0
  11. package/tools/redpanda-connect/helpers/buildConfigYaml.js +53 -0
  12. package/tools/redpanda-connect/helpers/commonConfig.js +31 -0
  13. package/tools/redpanda-connect/helpers/eq.js +10 -0
  14. package/tools/redpanda-connect/helpers/index.js +19 -0
  15. package/tools/redpanda-connect/helpers/isObject.js +1 -0
  16. package/tools/redpanda-connect/helpers/join.js +6 -0
  17. package/tools/redpanda-connect/helpers/ne.js +10 -0
  18. package/tools/redpanda-connect/helpers/or.js +4 -0
  19. package/tools/redpanda-connect/helpers/renderConnectExamples.js +37 -0
  20. package/tools/redpanda-connect/helpers/renderConnectFields.js +148 -0
  21. package/tools/redpanda-connect/helpers/renderLeafField.js +64 -0
  22. package/tools/redpanda-connect/helpers/renderObjectField.js +41 -0
  23. package/tools/redpanda-connect/helpers/renderYamlList.js +24 -0
  24. package/tools/redpanda-connect/helpers/toYaml.js +11 -0
  25. package/tools/redpanda-connect/helpers/uppercase.js +9 -0
  26. package/tools/redpanda-connect/parse-csv-connectors.js +63 -0
  27. package/tools/redpanda-connect/report-delta.js +152 -0
  28. package/tools/redpanda-connect/templates/connector.hbs +20 -0
  29. package/tools/redpanda-connect/templates/examples-partials.hbs +7 -0
  30. package/tools/redpanda-connect/templates/fields-partials.hbs +13 -0
  31. package/tools/redpanda-connect/templates/intro.hbs +33 -0
  32. package/macros/data-template.js +0 -591
package/README.adoc CHANGED
@@ -763,108 +763,6 @@ This section documents the Asciidoc macros that are provided by this library and
763
763
 
764
764
  IMPORTANT: Be sure to register each extension under the `asciidoc.extensions` key in the playbook, not the `antora.extensions` key.
765
765
 
766
- === data_template
767
-
768
- The `data_template` block processor lets you render dynamic AsciiDoc content from external or local data sources (JSON, YAML, or plain text) using Handlebars templates.
769
-
770
- This is useful for generating documentation from structured data like config fields, component metadata, or examples.
771
-
772
- === Usage
773
-
774
- You can use the `data_template` block macro to dynamically generate AsciiDoc content from structured data files such as JSON or YAML. The macro uses a Handlebars template to render the data.
775
-
776
- [source,asciidoc]
777
- ----
778
- [data_template, ROOT:example$connect.json]
779
- --
780
- == Component: {{{name}}}
781
-
782
- Summary: {{{summary}}}
783
-
784
- {{#each fields}}
785
- === {{name}}
786
-
787
- *Type*: `{{type}}`
788
-
789
- {{{description}}}
790
- {{/each}}
791
- --
792
- ----
793
-
794
- The block content is a Handlebars template. Fields from the data file are injected into this template during site build.
795
-
796
- The macro accepts one or two positional attributes:
797
-
798
- 1. The first attribute (`dataPath`) is required and should be the resource ID of the data file.
799
- 2. The second attribute (`overrides`) is optional and allows you to override or merge values from a secondary file.
800
-
801
- You can apply overrides by specifying a second file:
802
-
803
- [source,asciidoc]
804
- ----
805
- [data_template, ROOT:example$connect.json, ROOT:example$overrides.json]
806
- --
807
- ...template content...
808
- --
809
- ----
810
-
811
- In this case:
812
-
813
- - The macro first loads and parses `connect.json`.
814
- - Then it loads `overrides.json` and **merges** its values into the base file.
815
- - Arrays of objects (such as fields or processors) are merged by matching objects with the same `name` key.
816
- - The result is passed into the Handlebars template.
817
-
818
- This is useful for tweaking content (like updating a `description`) without modifying the original source file.
819
-
820
- ==== Triple mustaches
821
-
822
- When your data contains AsciiDoc markup (like lists, admonitions, or headings), use triple curly braces:
823
-
824
- [source,handlebars]
825
- ----
826
- {{{description}}}
827
- ----
828
-
829
- This tells Handlebars to not escape the content, so Asciidoctor can render it correctly.
830
-
831
- ==== Handlebars helpers
832
-
833
- The following helpers are available inside templates:
834
-
835
- * `eq`, `ne` — Equality helpers.
836
- * `uppercase` — Converts text to uppercase.
837
- * `renderConnectFields` — Renders config fields for Redpanda Connect.
838
- * `renderConnectExamples` — Renders usage examples.
839
- * `selectByJsonPath` — Selects items from the data using a JSONPath expression.
840
-
841
- ==== Registration
842
-
843
- To use this macro, register it in your Antora playbook:
844
-
845
- [source,yaml]
846
- ----
847
- asciidoc:
848
- extensions:
849
- - '@redpanda-data/docs-extensions-and-macros/macros/data-template'
850
- ----
851
-
852
- ==== Example
853
-
854
- You can use the `selectByJsonPath` helper to filter data. For example, if you want to render only the `redis` processor's fields from a JSON file, you can do it like this:
855
-
856
- [source,asciidoc]
857
- ----
858
- [data_template, redpanda-connect:ROOT:example$connect.json]
859
- --
860
- {{#selectByJsonPath this "$.processors[?(@.name=='redis')]" }}
861
- {{renderConnectFields this.config.children}}
862
- {{/selectByJsonPath}}
863
- --
864
- ----
865
-
866
- This will render only the fields for the `redis` processor.
867
-
868
766
  === config_ref
869
767
 
870
768
  This inline macro is used to generate a reference to a configuration value in the Redpanda documentation. The macro's parameters allow for control over the generated reference's format and the type of output produced.
@@ -909,67 +807,6 @@ asciidoc:
909
807
  - '@redpanda-data/docs-extensions-and-macros/macros/config-ref'
910
808
  ----
911
809
 
912
- === data_template
913
-
914
- The `data_template` macro provides a way to dynamically generate AsciiDoc content by combining external or local data sources with Handlebars templates. When you use the `data_template` block macro, the extension performs the following steps:
915
-
916
- * Resolves the `dataPath` attribute to locate a data file (in JSON, YAML, or raw text format).
917
- * Fetches and caches external resources or reads local files from the Antora content catalog.
918
- * Parses the data file.
919
- * Compiles the block's content as a Handlebars template, injecting the parsed data.
920
- * Processes the resulting text as AsciiDoc using Asciidoctor to generate the final HTML output.
921
-
922
- By default, Handlebars escapes HTML to prevent potential security issues. However, if your data includes AsciiDoc markup (such as headings, lists, or formatting directives), escaping it will prevent Asciidoctor from converting the markup correctly.
923
-
924
- To ensure that your AsciiDoc syntax is preserved during template rendering, **use the triple curly braces syntax** in your Handlebars templates. For example, if your JSON file contains a `description` field with AsciiDoc content, reference it like this:
925
-
926
- [source,handlebars]
927
- ----
928
- {{{description}}}
929
- ----
930
-
931
- This tells Handlebars to output the content unescaped, allowing Asciidoctor to process the raw AsciiDoc markup correctly.
932
-
933
- ==== Usage
934
-
935
- In an AsciiDoc document, you can invoke the data template macro as follows:
936
-
937
- [,asciidoc]
938
- ----
939
- [data_template, ROOT:example$connect.json]
940
- --
941
- Version: {{{version}}}
942
-
943
- {{#each buffers}}
944
-
945
- === {{{this.name}}}
946
-
947
- Status: {{{this.status}}}
948
-
949
- {{#if (eq this.name 'memory')}}
950
- This is a custom description for the memory buffer.
951
- {{else}}
952
- {{{this.summary}}}
953
- {{/if}}
954
-
955
- {{/each}}
956
-
957
- --
958
- ----
959
-
960
- ==== Registration
961
-
962
- Register the macro in your Antora playbook under the `asciidoc.extensions` key:
963
-
964
- [source,yaml]
965
- ----
966
- asciidoc:
967
- extensions:
968
- - require: '@redpanda-data/docs-extensions-and-macros/macros/data-template'
969
- ----
970
-
971
- This configuration ensures that during the build process, the data template macro is executed to fetch, parse, and render data as part of your docs.
972
-
973
810
  === glossterm
974
811
 
975
812
  The `glossterm` inline macro provides a way to define and reference glossary terms in your AsciiDoc documents.