Skip to main content

Markdown doc template config


Markdown doc template config

Version required: 2023.2.2+

Provides a custom format for local markdown and Online API doc.

Tech stack

  1. Velocityopen in new window
  2. Markdown

Build-in variable

Content variable

KeyParameter typeDescription
urlStringFinal url
originUrlStringOrigin url, contains the name of the original path variable
namingPolicyStringAPI namingPolicy, fixed value[1.byMethodName:by java method name 2.byDoc:by JavaDoc or Swagger method description]
methodNameStringJava method name
methodDescriptionStringMethod description, comes from javadoc or Swagger method description
methodTypeStringMethod type, for example Get,Post,Put,Delete,Patch
headerListList<Header>Header params
pathKeyValueListList<KeyValue>Url Path params
urlParamsKeyValueListList<KeyValue>Url Query params
multipartKeyValueListList<KeyValue>Multipart params
urlEncodedKeyValueListList<KeyValue>Form Url-Encoded params
jsonParamStringJson params
jsonParamDocumentStringJson params document
responseExampleStringResponse
returnDocumentStringResponse params document

Syntax variables

KeyDescription
H1Markdown #
H2Markdown ##
H3Markdown ###
H4Markdown ####
H5Markdown #####
H6Markdown ######

Parameter type

KeyParameter typeDescription
enabledBooleanEnable flag
typeStringKey of Header
valueStringValue of Header

KeyValue

KeyParameter typeDescription
enabledBooleanEnable flag
keyStringParameter key
typeStringParameter type, fixed value [Object Array String Number Boolean]
valueObjectParameter value
commentStringParameter description

Default template

    #if (${namingPolicy}=='byDoc')
    $H1 ${methodDescription}
    #else
    $H1 $!{methodName}

    $H3 Method description

    ```
    $!{methodDescription}
    ```
    #end

    > URL: $!{url}
    >
    > Origin Url: $!{originUrl}
    >
    > Type: $!{methodType}


    $H3 Request headers

    |Header Name| Header Value|
    |---------|------|
    #foreach( $h in ${headerList})
    |$h.type|$h.value|
    #end

    $H3 Parameters

    $H5 Path parameters

    | Parameter | Type | Value | Description |
    |---------|------|------|------------|
    #foreach( $node in ${pathKeyValueList})
    |$node.key|$!{node.type}|$!{node.value}|$!{node.comment}|
    #end


    $H5 URL parameters

    |Required| Parameter | Type | Value | Description |
    |---------|---------|------|------|------------|
    #foreach( $node in ${urlParamsKeyValueList})
    |$!{node.enabled}|$!{node.key}|$!{node.type}|$!{node.value}|$!{node.comment}|
    #end


    $H5 Body parameters

    $H6 JSON

    ```
    ${jsonParam}
    ```

    $H6 JSON document

    ```
    ${jsonParamDocument}
    ```


    $H5 Form URL-Encoded
    |Required| Parameter | Type | Value | Description |
    |---------|---------|------|------|------------|
    #foreach( $node in ${urlEncodedKeyValueList})
    |$!{node.enabled}|$!{node.key}|$!{node.type}|$!{node.value}|$!{node.comment}|
    #end


    $H5 Multipart
    |Required | Parameter | Type | Value | Description |
    |---------|---------|------|------|------------|
    #foreach( $node in ${multipartKeyValueList})
    |$!{node.enabled}|$!{node.key}|$!{node.type}|$!{node.value}|$!{node.comment}|
    #end


    $H3 Response

    $H5 Response example

    ```
    $!{responseExample}
    ```

    $H5 Response document
    ```
    $!{returnDocument}
    ```

Last update: