fixes + added new sidebars
This commit is contained in:
+2
@@ -9,6 +9,8 @@ const authProviderOptions: FormattingOptionsType = {
|
||||
reflectionDescription: `In this document, you’ll learn how to create an auth provider module and the methods you must implement in its main service.`,
|
||||
frontmatterData: {
|
||||
slug: "/references/auth/provider",
|
||||
tags: ["auth", "server", "how to"],
|
||||
sidebar_label: "Create Auth Provider",
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create an Auth Provider Module",
|
||||
|
||||
+2
@@ -9,6 +9,8 @@ const fulfillmentProviderOptions: FormattingOptionsType = {
|
||||
reflectionDescription: `In this document, you’ll learn how to create a fulfillment provider module and the methods you must implement in its main service.`,
|
||||
frontmatterData: {
|
||||
slug: "/references/fulfillment/provider",
|
||||
tags: ["fulfillment", "server", "how to"],
|
||||
sidebar_label: "Create Fulfillment Provider",
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Fulfillment Provider Module",
|
||||
|
||||
+2
@@ -9,6 +9,8 @@ const notificationOptions: FormattingOptionsType = {
|
||||
reflectionDescription: `In this document, you’ll learn how to create a notification provider module and the methods you must implement in it.`,
|
||||
frontmatterData: {
|
||||
slug: "/references/notification-provider-module",
|
||||
tags: ["notification", "server", "how to"],
|
||||
sidebar_label: "Create Notification Provider",
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Notification Provider Module",
|
||||
|
||||
+2
@@ -9,6 +9,8 @@ const paymentProviderOptions: FormattingOptionsType = {
|
||||
reflectionDescription: `In this document, you’ll learn how to create a Payment Provider to be used with the Payment Module.`,
|
||||
frontmatterData: {
|
||||
slug: "/references/payment/provider",
|
||||
tags: ["payment", "server", "how to"],
|
||||
sidebar_label: "Create Payment Provider",
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Payment Provider",
|
||||
|
||||
+2
@@ -8,6 +8,8 @@ const taxProviderOptions: FormattingOptionsType = {
|
||||
reflectionDescription: `In this document, you’ll learn how to create a tax provider to use with the Tax Module, and the methods to implement.`,
|
||||
frontmatterData: {
|
||||
slug: "/references/tax/provider",
|
||||
tags: ["tax", "server", "how to"],
|
||||
sidebar_label: "Create Tax Provider",
|
||||
},
|
||||
reflectionTitle: {
|
||||
fullReplacement: "How to Create a Tax Provider",
|
||||
|
||||
+14
-5
@@ -3,8 +3,8 @@ import { MarkdownTheme } from "../../theme.js"
|
||||
import { stringify } from "yaml"
|
||||
import { replaceTemplateVariables } from "../../utils/reflection-template-strings.js"
|
||||
import { Reflection } from "typedoc"
|
||||
import { FrontmatterData } from "types"
|
||||
import { getTagComments, getTagsAsArray, getUniqueStrArray } from "utils"
|
||||
import { FrontmatterData, Tag } from "types"
|
||||
import { getTagComments, getTagsAsArray } from "utils"
|
||||
|
||||
export default function (theme: MarkdownTheme) {
|
||||
Handlebars.registerHelper("frontmatter", function (this: Reflection) {
|
||||
@@ -30,9 +30,7 @@ export default function (theme: MarkdownTheme) {
|
||||
resolvedFrontmatter["tags"]?.push(...tagContent)
|
||||
})
|
||||
if (resolvedFrontmatter["tags"]?.length) {
|
||||
resolvedFrontmatter["tags"] = getUniqueStrArray(
|
||||
resolvedFrontmatter["tags"]
|
||||
)
|
||||
resolvedFrontmatter["tags"] = getUniqueTags(resolvedFrontmatter["tags"])
|
||||
}
|
||||
|
||||
return `---\n${stringify(resolvedFrontmatter).trim()}\n---\n\n`
|
||||
@@ -57,3 +55,14 @@ function resolveFrontmatterVariables(
|
||||
|
||||
return tempFrontmatterData
|
||||
}
|
||||
|
||||
function getUniqueTags(tags: Tag[]): Tag[] {
|
||||
const tagsMap = new Map<string, Tag>()
|
||||
tags.forEach((tag) => {
|
||||
const tagName = typeof tag === "string" ? tag : tag.name
|
||||
|
||||
tagsMap.set(tagName, tag)
|
||||
})
|
||||
|
||||
return Array.from(tagsMap.values())
|
||||
}
|
||||
|
||||
+8
-1
@@ -50,11 +50,18 @@ export type FormattingOptionsType = {
|
||||
[k: string]: FormattingOptionType
|
||||
}
|
||||
|
||||
export type Tag =
|
||||
| string
|
||||
| {
|
||||
name: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export type FrontmatterData = {
|
||||
slug?: string
|
||||
sidebar_label?: string
|
||||
displayed_sidebar?: string
|
||||
tags?: string[]
|
||||
tags?: Tag[]
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user