Skip to content

Commit

Permalink
Escape HTML in linear output (#62)
Browse files Browse the repository at this point in the history
* Escape HTML

* Update CHANGELOG.md
  • Loading branch information
marians committed Mar 6, 2024
1 parent 38daefe commit c539c01
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,13 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

## [Unreleased]
- Make sure HTML is escaped in linear output.

## [0.0.5] - 2024-02-27

### Added

- New flag layout to allow multiple rendering options

## [0.0.4] - 2023-12-06
Expand Down
8 changes: 4 additions & 4 deletions pkg/generate/templates/linear.md.tpl
Expand Up @@ -10,13 +10,13 @@
<h3 class="headline-with-link">
<a class="header-link" href="#{{.Slug}}">
<i class="fa fa-link"></i>
</a>{{.Title}}
</a>{{ .Title | html }}
</h3>
{{- if .Description }}
<h4 class="headline-with-link">
<a class="header-link" href="#">
<i class="fa fa-link"></i>
</a>{{ .Description }}
</a>{{ .Description | html }}
</h4>
{{- end }}
{{- range .Rows }}
Expand All @@ -31,7 +31,7 @@
<div class="property-body">
<div class="property-meta">
{{- if .Title -}}
<span class="property-title">{{- .Title -}}</span><br />
<span class="property-title">{{- .Title | html -}}</span><br />
{{- end -}}
{{- if ne (len .Types) 0 -}}
{{- range $index, $element := .Types -}}
Expand All @@ -41,7 +41,7 @@
</div>
<div class="property-description">
{{- if .Description -}}
{{- .Description -}}
{{- .Description | html -}}
{{- end -}}
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions pkg/generate/testdata/output-linear.txt
Expand Up @@ -311,7 +311,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Additional VPCs</span><br /><span class="property-type">array</span>&nbsp;
</div>
<div class="property-description">If DNS mode is 'private', the VPCs specified here will be assigned to the private hosted zone.</div>
<div class="property-description">If DNS mode is &#39;private&#39;, the VPCs specified here will be assigned to the private hosted zone.</div>
</div>
</div>
<div class="property depth-0">
Expand Down Expand Up @@ -402,7 +402,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">VPC subnet</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">IPv4 address range to assign to this cluster's VPC, in CIDR notation.</div>
<div class="property-description">IPv4 address range to assign to this cluster&#39;s VPC, in CIDR notation.</div>
</div>
</div>
<div class="property depth-0">
Expand Down Expand Up @@ -662,7 +662,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Prefix list ID</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">ID of the managed prefix list to use when the topology mode is set to 'UserManaged'.</div>
<div class="property-description">ID of the managed prefix list to use when the topology mode is set to &#39;UserManaged&#39;.</div>
</div>
</div>
<div class="property depth-0">
Expand All @@ -675,7 +675,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Transit gateway ID</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">If the topology mode is set to 'UserManaged', this can be used to specify the transit gateway to use.</div>
<div class="property-description">If the topology mode is set to &#39;UserManaged&#39;, this can be used to specify the transit gateway to use.</div>
</div>
</div>
<div class="property depth-0">
Expand All @@ -701,7 +701,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">VPC mode</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">Whether the cluser's VPC is created with public, internet facing resources (public subnets, NAT gateway) or not (private).</div>
<div class="property-description">Whether the cluser&#39;s VPC is created with public, internet facing resources (public subnets, NAT gateway) or not (private).</div>
</div>
</div>
<h3 class="headline-with-link">
Expand Down Expand Up @@ -836,7 +836,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Timeout for ready</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">If a node is not in condition 'Ready' after this timeout, it will be considered unhealthy.</div>
<div class="property-description">If a node is not in condition &#39;Ready&#39; after this timeout, it will be considered unhealthy.</div>
</div>
</div>
<div class="property depth-0">
Expand All @@ -849,7 +849,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Timeout for unknown condition</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">If a node is in 'Unknown' condition after this timeout, it will be considered unhealthy.</div>
<div class="property-description">If a node is in &#39;Unknown&#39; condition after this timeout, it will be considered unhealthy.</div>
</div>
</div>
<div class="property depth-0">
Expand All @@ -875,7 +875,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Certificate authority</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">Identity provider's CA certificate in PEM format.</div>
<div class="property-description">Identity provider&#39;s CA certificate in PEM format.</div>
</div>
</div>
<div class="property depth-0">
Expand Down Expand Up @@ -1303,7 +1303,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Cluster description</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description">User-friendly description of the cluster's purpose.</div>
<div class="property-description">User-friendly description of the cluster&#39;s purpose.</div>
</div>
</div>
<div class="property depth-0">
Expand Down Expand Up @@ -1591,7 +1591,7 @@
<div class="property-body">
<div class="property-meta"><span class="property-title">Base DNS domain</span><br /><span class="property-type">string</span>&nbsp;
</div>
<div class="property-description"></div>
<div class="property-description">Description with a &#34;quoted&#34; word.</div>
</div>
</div>
<div class="property depth-0">
Expand Down
2 changes: 1 addition & 1 deletion pkg/generate/testdata/output.txt
Expand Up @@ -173,7 +173,7 @@ Properties within the `.nodePools` top-level object

| **Property** | **Description** | **More Details** |
| :----------- | :-------------- | :--------------- |
| `baseDomain` | **Base DNS domain**|**Type:** `string`<br/>|
| `baseDomain` | **Base DNS domain** - Description with a "quoted" word.|**Type:** `string`<br/>|
| `cluster-shared` | **Library chart**|**Type:** `object`<br/>|
| `provider` | **Cluster API provider name**|**Type:** `string`<br/>|

1 change: 1 addition & 0 deletions pkg/generate/testdata/schema.json
Expand Up @@ -95,6 +95,7 @@
"properties": {
"baseDomain": {
"title": "Base DNS domain",
"description": "Description with a \"quoted\" word.",
"type": "string"
},
"cluster-shared": {
Expand Down

0 comments on commit c539c01

Please sign in to comment.