docs-util: support @version tag (#10591)
This commit is contained in:
@@ -254,11 +254,7 @@ export class EntityBuilder {
|
|||||||
* This method defines a float property that allows for
|
* This method defines a float property that allows for
|
||||||
* values with decimal places
|
* values with decimal places
|
||||||
*
|
*
|
||||||
* :::note
|
* @version 2.1.2
|
||||||
*
|
|
||||||
* This property is only available after Medusa v2.1.2.
|
|
||||||
*
|
|
||||||
* :::
|
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* import { model } from "@medusajs/framework/utils"
|
* import { model } from "@medusajs/framework/utils"
|
||||||
|
|||||||
@@ -49,6 +49,10 @@
|
|||||||
{
|
{
|
||||||
"tagName": "@parentIgnore",
|
"tagName": "@parentIgnore",
|
||||||
"syntaxKind": "block"
|
"syntaxKind": "block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tagName": "@version",
|
||||||
|
"syntaxKind": "block"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,7 @@ import workflowDiagramHelper from "./resources/helpers/workflow-diagram"
|
|||||||
import workflowHooksHelper from "./resources/helpers/workflow-hooks"
|
import workflowHooksHelper from "./resources/helpers/workflow-hooks"
|
||||||
import ifMemberShowTitleHelper from "./resources/helpers/if-member-show-title"
|
import ifMemberShowTitleHelper from "./resources/helpers/if-member-show-title"
|
||||||
import signatureCommentHelper from "./resources/helpers/signature-comment"
|
import signatureCommentHelper from "./resources/helpers/signature-comment"
|
||||||
|
import versionHelper from "./resources/helpers/version"
|
||||||
import { MarkdownTheme } from "./theme"
|
import { MarkdownTheme } from "./theme"
|
||||||
|
|
||||||
const TEMPLATE_PATH = path.join(__dirname, "resources", "templates")
|
const TEMPLATE_PATH = path.join(__dirname, "resources", "templates")
|
||||||
@@ -180,4 +181,5 @@ export function registerHelpers(theme: MarkdownTheme) {
|
|||||||
workflowHooksHelper(theme)
|
workflowHooksHelper(theme)
|
||||||
ifMemberShowTitleHelper(theme)
|
ifMemberShowTitleHelper(theme)
|
||||||
signatureCommentHelper()
|
signatureCommentHelper()
|
||||||
|
versionHelper()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const EXCLUDED_TAGS = [
|
|||||||
"@featureFlag",
|
"@featureFlag",
|
||||||
"@category",
|
"@category",
|
||||||
"@typeParamDefinition",
|
"@typeParamDefinition",
|
||||||
|
"@version",
|
||||||
]
|
]
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import * as Handlebars from "handlebars"
|
||||||
|
import { Reflection } from "typedoc"
|
||||||
|
|
||||||
|
export default function () {
|
||||||
|
Handlebars.registerHelper("version", function (reflection: Reflection) {
|
||||||
|
const versionTag = reflection.comment?.blockTags.find(
|
||||||
|
(tag) => tag.tag === "@version"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!versionTag) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
const tagContent = versionTag.content
|
||||||
|
.map((content) => content.text)
|
||||||
|
.join("")
|
||||||
|
|
||||||
|
return `:::note\n\nThis is only available after Medusa \`v${tagContent}\`.\n\n:::`
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
{{> comment}}
|
{{> comment}}
|
||||||
|
|
||||||
|
{{{version this}}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (sectionEnabled "member_declaration_example")}}
|
{{#if (sectionEnabled "member_declaration_example")}}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
|
{{{version this}}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (sectionEnabled "member_signature_example")}}
|
{{#if (sectionEnabled "member_signature_example")}}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
|
{{{version this}}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (sectionEnabled "member_signature_example")}}
|
{{#if (sectionEnabled "member_signature_example")}}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
{{{signatureComment}}}
|
{{{signatureComment}}}
|
||||||
|
|
||||||
|
{{{version this}}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (sectionEnabled "member_signature_example")}}
|
{{#if (sectionEnabled "member_signature_example")}}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
{{> comment}}
|
{{> comment}}
|
||||||
|
|
||||||
|
{{{version this}}}
|
||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (sectionEnabled "member_signature_example")}}
|
{{#if (sectionEnabled "member_signature_example")}}
|
||||||
|
|||||||
Reference in New Issue
Block a user