kcl-lang / kcl

KCL Programming Language (CNCF Sandbox Project). https://kcl-lang.io
https://kcl-lang.io
Apache License 2.0
1.41k stars 110 forks source link

When I use attribute as a literal type, the doc generate error. #1426

Closed LinYunling closed 1 week ago

LinYunling commented 1 week ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

schema ResourceModel:
    '''
        Resource Model Definition

        Attributes
        ----------
        name: str
            The name of resource.
        alias: str
            The alias name of resource.
        type: "PC" | "Notebook" | "IPad" | "SmartPhone" = "PC"
            The type of resource.

        Examples
        ----------------------
        res = ResourceModel {
            name = "ServerA"
            alias = "My Computer"
            type = "PC"
        }
    '''
    name: str
    alias?: str
    type: "PC" | "Notebook" | "IPad" | "SmartPhone" = "PC"

generate the doc

2. What did you expect to see? (Required)

image

3. What did you see instead (Required)

image

4. What is your KCL components version? (Required)

0.9.0-beta.1

Peefy commented 1 week ago

Hello @LinYunling You can use the command kcl doc gen --escape-html to escape the | character in the string literal union types.

LinYunling commented 1 week ago

thanks