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

The markdown in parameters property description or in response schema property description is not convert to right html text. #95

Open
sgguo opened this issue Jul 2, 2021 · 0 comments

Comments

@sgguo
Copy link

sgguo commented Jul 2, 2021

  1. test below yaml file.
openapi: 3.0.0
info:
  title: Markdown Content
  description: Test case to show markdown support. For more info check specification (http://spec.openapis.org/oas/v3.0.3)
  version: 1.0.0
paths:
  /markdown:
    get:
      summary: Markdown in Description.
      description: |
        Endpoint to create and initiate a pipeline.

        ### Paragraph
        In a hole in the ground there lived a hobbit. Not a **nasty**, _dirty_, `wet` hole, filled with the ends
        of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
        eat: it was a [hobbit-hole](https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles"), and that means comfort.


        ### Horizontal Rule `---`
        ---

        ### Number List
        1. Install `node`.
        2. Install `npm`.
        3. Open your editor
        4. Create a JavaScript file

        ### Blockquotes
        > This is a sample OpenAPI spec to test the parsing of various markdown styles
        > (RapiDoc supports common-mark syntax)

        ### Buleted List
        - Install `node`.
        - Install `npm`.
        - Open you editor
        - Create a JavaScript file

        ### Table
        | Heading 1 | Left-Justified | Centered | Right-Justified |
        | --------- | :------------- | :------: | --------------: |
        | text | text | text | text |
        | text | text | text | text |
        | text | text | text | text |

        ### Code
        ```
        $ curl -X POST -is -u username:password
          -H "Content-Type: application/json" https://example.com
          -d '{
          "target": {
            "ref_type": "branch",
            "type": "pipeline_ref_target",
            "ref_name": "master"
          }'
        }
        ```
        ### Code (with syntax highlight)
        ```bash
        $ curl -X POST -is -u username:password
          -H "Content-Type: application/json" https://example.com
          -d '{
          "target": {
            "ref_type": "branch",
            "type": "pipeline_ref_target",
            "ref_name": "master"
          }'
        }
        ```

        ### Use HTML in markdown
        <br>
        <div style="color: white; background-color:SlateBlue; padding: 12px; border-radius:2px">
          Markdown do not support colors or fancy HTML designs. However, if you need you can put some html directly inside the markup with some inline styling.
          This box I designed using raw HTML inside the markdown
        </div>
        <br>
        <div style="color:#bbb; background-color:#444; padding: 12px 0px 12px 12px;border-left: 5px solid #F06560;">
          <b style="color:#F06560">TIP</b>  Here is another one, done using HTML inside markdown with two different colors to make it appear like a TIP
        </div>
        <br>


        ### Images


      parameters:
        - name: full-name
          in: query
          description: |
           Field descriptions can contain `Markdown` (Markdown must be monospaced)<br/>
           **CONSTRAINTS**
           ```
            - At least 3 characters
            - Cannot have space
            - Cannot have number
            - First Letter must be capital
           ```
          required: true
          schema:
            type: string
            minimum: 3
        - name: height
          in: query
          description: Height in `inches` (inches must be monospaced)
          required: true
          schema:
            type: integer
            format: int32
            minimum: 12
            maximum: 120
        - name: interests
          in: query
          required: true
          description: |
            Default is `hiking` (hiking must be monospaced)

            | Heading 1 | Left-Justified | Centered | Right-Justified |
            | --------- | :------------- | :------: | --------------: |
            | text | text | text | text |
            | text | text | text | text |
            | text | text | text | text |

          schema:
            type: array
            minItems: 1
            maxItems: 3
            items:
              type: string
              enum:
                - computers
                - hiking
                - swiming
              default: hiking

      responses:
        '200':
          description: Response Schema field contains `Markdown` contents  (Markdown must be monospaced)
          content:
            application/json:
              schema:
                type: object
                description: Description of `Person` object (Person must be monospaced)
                properties:
                  fullName:
                    description: Person's Full name is made up of `firstName` and `lastName` (firstName and lastName must be mono-spaced).
                    type: object
                    properties:
                      firstName:
                        description: |-
                          _First name_ (First name should be italics)

                          | Heading 1 | Left-Justified | Centered | Right-Justified |
                          | --------- | :------------- | :------: | --------------: |
                          | text | text | text | text |
                          | text | text | text | text |
                          | text | text | text | text |
                        type: string
                      lastName:
                        description: |
                          `Last name` (last name must be monospaced)
                        type: string
                  hobbies:
                    type: array
                    description:  list of words separated by `comma` (comma should be monospaced).
                    items:
                      type: string
                  dependentNames:
                    type: array
                    description: Array of **Dependents** (Dependents must be bold).
                    items:
                      type: object
                      description: Full Name Object is made up of `firstName` and `lastName` (firstName and lastName must be mono-spaced).
                      properties:
                        fullName:
                          description: Parts of **First Name** (First Name must be bold)
                          type: object
                          properties:
                            firstName:
                              description: Dependent First Name
                              type: string
                            lastName:
                              description: Dependent Last Name
                              type: string
          headers:
            Link:
              required: true
              schema:
                type: string
              description: |
                Pagination links are included in the Link header of responses.
                It is important to follow these Link header values instead of constructing your own URLs as query parameters or cursor formats may change without notice.

                | Link Relation | Description                                         |
                |:--------------|:----------------------------------------------------|
                | first         | The URL of the immediate first page of results      |
                | last          | The URL of the immediate last page of results       |
                | next          | The URL of the immediate next page of results       |
                | prev          | The URL of the immediate previous page of results   |
                | self          | The URL of the immediate current page of results    |
  1. markdown text in description part of parameters or schema property's are directly shown in pdf, no any convert here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant