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

feat: doc gen html escape for default value #218

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/tools/gen/templates/doc/schemaDoc.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

| name | type | description | default value |
| --- | --- | --- | --- |
{{range $name, $property := $Data.Properties}}|**{{$name}}**{{if containsString $Data.Required $name }} `required`{{end}}{{if $property.ReadOnly}} `readOnly`{{end}}|{{kclType $property $EscapeHtml}}|{{if ne $property.Description ""}}{{escapeHtml $property.Description $EscapeHtml}}{{end}}|{{$property.Default}}|
{{range $name, $property := $Data.Properties}}|**{{$name}}**{{if containsString $Data.Required $name }} `required`{{end}}{{if $property.ReadOnly}} `readOnly`{{end}}|{{kclType $property $EscapeHtml}}|{{if ne $property.Description ""}}{{escapeHtml $property.Description $EscapeHtml}}{{end}}|{{escapeHtml $property.Default $EscapeHtml}}|
{{end}}{{if ne (len $Data.Examples) 0}}#### Examples

{{range $name, $example := $Data.Examples}}{{if $example.Summary}}**$example.Summary**
Expand Down
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/pkg/container.k
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ schema Container:
The name of the long-running container.
"""
name: str
image: str
3 changes: 2 additions & 1 deletion pkg/tools/gen/testdata/doc/pkg/md/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Container is the common user interface for long-running services.

| name | type | description | default value |
| --- | --- | --- | --- |
|**image** `required`|str|||
|**name** `required`|str|The name of the long-running container.||
### Server

Expand All @@ -40,7 +41,7 @@ Server is the common user interface for long-running services adopting the best
|**litFloat** `required` `readOnly`|1.11||1.11|
|**litInt** `required` `readOnly`|123||123|
|**litStr** `required` `readOnly`|"abc"||"abc"|
|**mainContainer** `required`|[Container](#container)|||
|**mainContainer** `required`|[Container](#container)||Container {<br /> name = "main"<br /> image = "image"<br />}|
|**name** `required`|str|A Server-level attribute.<br />The name of the long-running service.<br />See also: kusion_models/core/v1/metadata.k.||
|**numMultiplier** `required`|units.NumberMultiplier||1M|
|**others** `required`|any|||
Expand Down
5 changes: 4 additions & 1 deletion pkg/tools/gen/testdata/doc/pkg/server.k
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ schema Server:
age: int
height: float
port: int | str
mainContainer: Container
mainContainer: Container = Container {
name = "main"
image = "image"
}
antiSelf: bool
others: any
litStr: "abc"
Expand Down
Loading