diff --git a/src/project/types/website/website-giscus.ts b/src/project/types/website/website-giscus.ts index 512deccc7dd..b111e64df31 100644 --- a/src/project/types/website/website-giscus.ts +++ b/src/project/types/website/website-giscus.ts @@ -30,54 +30,59 @@ export async function resolveFormatForGiscus( project: ProjectContext, format: Format, ) { - const comments = format.metadata[kComments] as Record; - if (comments) { - const giscusOptions = comments[kGiscus] as Record; - if (giscusOptions) { - // Giscus is configured, so we need to check whether the - // the repo-id and category-id are set. If they are not, - // we need to fetch them and populate them into the format - if ( - giscusOptions[kGiscusRepoId] === undefined || - giscusOptions[kGiscusCategoryId] === undefined - ) { - const repo = giscusOptions.repo as string; - const fileName = `${repo}.json`; + const comments = format.metadata[kComments] as + | Record + | false + | undefined; + if (!comments) return; - let giscusMeta: GithubDiscussionMetadata; - // The scratch directory used to cache metadata - const giscusPath = projectScratchPath(project.dir, kGiscusDir); - ensureDirSync(giscusPath); + const giscusOptions = comments[kGiscus] as + | Record + | undefined; + if (!giscusOptions) return; - // The path to the metadata file for this repo - const path = join( - giscusPath, - fileName.replace("/", "."), - ); + // Giscus is configured, so we need to check whether the + // the repo-id and category-id are set. If they are not, + // we need to fetch them and populate them into the format + if ( + giscusOptions[kGiscusRepoId] !== undefined && + giscusOptions[kGiscusCategoryId] !== undefined + ) return; - try { - // Try to read the cached data and use that - const giscusJson = Deno.readTextFileSync(path); - giscusMeta = JSON.parse(giscusJson); - } catch { - // Couldn't read the cached metadata, fetch it - removeIfExists(path); - giscusMeta = await getGithubDiscussionsMetadata(repo); - const jsonStr = JSON.stringify(giscusMeta, undefined, 2); - Deno.writeTextFileSync(path, jsonStr); - } + const repo = giscusOptions.repo as string; + const fileName = `${repo}.json`; - // Populate the ids if need be - if (giscusOptions[kGiscusRepoId] === undefined) { - giscusOptions[kGiscusRepoId] = giscusMeta.repositoryId; - } - if (giscusOptions[kGiscusCategoryId] === undefined) { - giscusOptions[kGiscusCategoryId] = getDiscussionCategoryId( - (giscusOptions[kGiscusCategoryId] || "") as string, - giscusMeta, - ); - } - } - } + let giscusMeta: GithubDiscussionMetadata; + // The scratch directory used to cache metadata + const giscusPath = projectScratchPath(project.dir, kGiscusDir); + ensureDirSync(giscusPath); + + // The path to the metadata file for this repo + const path = join( + giscusPath, + fileName.replace("/", "."), + ); + + try { + // Try to read the cached data and use that + const giscusJson = Deno.readTextFileSync(path); + giscusMeta = JSON.parse(giscusJson); + } catch { + // Couldn't read the cached metadata, fetch it + removeIfExists(path); + giscusMeta = await getGithubDiscussionsMetadata(repo); + const jsonStr = JSON.stringify(giscusMeta, undefined, 2); + Deno.writeTextFileSync(path, jsonStr); + } + + // Populate the ids if need be + if (giscusOptions[kGiscusRepoId] === undefined) { + giscusOptions[kGiscusRepoId] = giscusMeta.repositoryId; + } + if (giscusOptions[kGiscusCategoryId] === undefined) { + giscusOptions[kGiscusCategoryId] = getDiscussionCategoryId( + (giscusOptions[kGiscusCategoryId] || "") as string, + giscusMeta, + ); } } diff --git a/src/resources/editor/tools/vs-code.mjs b/src/resources/editor/tools/vs-code.mjs index c6c2c2bd804..2e863660b82 100644 --- a/src/resources/editor/tools/vs-code.mjs +++ b/src/resources/editor/tools/vs-code.mjs @@ -8600,7 +8600,127 @@ var require_yaml_intelligence_resources = __commonJS({ } }, { - id: "comments", + id: "giscus-configuration", + object: { + closed: true, + properties: { + repo: { + string: { + description: { + short: "The Github repo that will be used to store comments.", + long: "The Github repo that will be used to store comments.\n\nIn order to work correctly, the repo must be public, with the giscus app installed, and \nthe discussions feature must be enabled.\n" + } + } + }, + "repo-id": { + string: { + description: { + short: "The Github repository identifier.", + long: "The Github repository identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" + } + } + }, + category: { + string: { + description: { + short: "The discussion category where new discussions will be created.", + long: "The discussion category where new discussions will be created. It is recommended \nto use a category with the **Announcements** type so that new discussions \ncan only be created by maintainers and giscus.\n" + } + } + }, + "category-id": { + string: { + description: { + short: "The Github category identifier.", + long: "The Github category identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" + } + } + }, + mapping: { + anyOf: [ + { + enum: [ + "pathname", + "url", + "title", + "og:title" + ] + }, + "string" + ], + description: { + short: "The mapping between the page and the embedded discussion.", + long: "The mapping between the page and the embedded discussion. \n\n- `pathname`: The discussion title contains the page path\n- `url`: The discussion title contains the page url\n- `title`: The discussion title contains the page title\n- `og:title`: The discussion title contains the `og:title` metadata value\n- any other string or number: Any other strings will be passed through verbatim and a discussion title\ncontaining that value will be used. Numbers will be treated\nas a discussion number and automatic discussion creation is not supported.\n" + } + }, + "reactions-enabled": { + boolean: { + description: "Display reactions for the discussion's main post before the comments." + } + }, + loading: { + enum: [ + "lazy" + ], + description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." + }, + "input-position": { + enum: [ + "top", + "bottom" + ], + description: "Place the comment input box above or below the comments." + }, + theme: { + anyOf: [ + "string", + { + ref: "giscus-themes" + }, + { + object: { + closed: true, + properties: { + light: { + anyOf: [ + "string", + { + ref: "giscus-themes" + } + ], + description: "The light theme name." + }, + dark: { + anyOf: [ + "string", + { + ref: "giscus-themes" + } + ], + description: "The dark theme name." + } + } + } + } + ], + description: { + short: "The giscus theme to use when displaying comments.", + long: "The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: \n\n```yaml\nwebsite:\n comments:\n giscus:\n theme:\n light: light # giscus theme used for light website theme\n dark: dark_dimmed # giscus theme used for dark website theme\n```\n" + } + }, + language: { + string: { + description: "The language that should be used when displaying the commenting interface." + } + } + }, + required: [ + "repo" + ] + } + }, + { + id: "document-comments-configuration", anyOf: [ { enum: [ @@ -8664,123 +8784,7 @@ var require_yaml_intelligence_resources = __commonJS({ } }, giscus: { - object: { - closed: true, - properties: { - repo: { - string: { - description: { - short: "The Github repo that will be used to store comments.", - long: "The Github repo that will be used to store comments.\n\nIn order to work correctly, the repo must be public, with the giscus app installed, and \nthe discussions feature must be enabled.\n" - } - } - }, - "repo-id": { - string: { - description: { - short: "The Github repository identifier.", - long: "The Github repository identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" - } - } - }, - category: { - string: { - description: { - short: "The discussion category where new discussions will be created.", - long: "The discussion category where new discussions will be created. It is recommended \nto use a category with the **Announcements** type so that new discussions \ncan only be created by maintainers and giscus.\n" - } - } - }, - "category-id": { - string: { - description: { - short: "The Github category identifier.", - long: "The Github category identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" - } - } - }, - mapping: { - anyOf: [ - { - enum: [ - "pathname", - "url", - "title", - "og:title" - ] - }, - "string" - ], - description: { - short: "The mapping between the page and the embedded discussion.", - long: "The mapping between the page and the embedded discussion. \n\n- `pathname`: The discussion title contains the page path\n- `url`: The discussion title contains the page url\n- `title`: The discussion title contains the page title\n- `og:title`: The discussion title contains the `og:title` metadata value\n- any other string or number: Any other strings will be passed through verbatim and a discussion title\ncontaining that value will be used. Numbers will be treated\nas a discussion number and automatic discussion creation is not supported.\n" - } - }, - "reactions-enabled": { - boolean: { - description: "Display reactions for the discussion's main post before the comments." - } - }, - loading: { - enum: [ - "lazy" - ], - description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." - }, - "input-position": { - enum: [ - "top", - "bottom" - ], - description: "Place the comment input box above or below the comments." - }, - theme: { - anyOf: [ - "string", - { - ref: "giscus-themes" - }, - { - object: { - closed: true, - properties: { - light: { - anyOf: [ - "string", - { - ref: "giscus-themes" - } - ], - description: "The light theme name." - }, - dark: { - anyOf: [ - "string", - { - ref: "giscus-themes" - } - ], - description: "The dark theme name." - } - } - } - } - ], - description: { - short: "The giscus theme to use when displaying comments.", - long: "The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: \n\n```yaml\nwebsite:\n comments:\n giscus:\n theme:\n light: light # giscus theme used for light website theme\n dark: dark_dimmed # giscus theme used for dark website theme\n```\n" - } - }, - language: { - string: { - description: "The language that should be used when displaying the commenting interface." - } - } - }, - required: [ - "repo" - ] - } + ref: "giscus-configuration" }, hypothesis: { anyOf: [ @@ -9978,7 +9982,7 @@ var require_yaml_intelligence_resources = __commonJS({ }, comments: { schema: { - ref: "comments" + ref: "document-comments-configuration" } }, "open-graph": { @@ -13262,7 +13266,7 @@ var require_yaml_intelligence_resources = __commonJS({ ] }, schema: { - ref: "comments" + ref: "document-comments-configuration" }, description: "Configuration for document commenting." } @@ -22964,7 +22968,6 @@ var require_yaml_intelligence_resources = __commonJS({ "The light theme name, theme scss file, or a mix of both.", "The dark theme name, theme scss file, or a mix of both.", "The dark theme name, theme scss file, or a mix of both.", - "Array of rendering names, e.g. [light, dark]", "Classes to apply to the body of the document.", "Disables the built in html features like theming, anchor sections,\ncode block behavior, and more.", "Enables inclusion of Pandoc default CSS for this document.", @@ -24069,7 +24072,76 @@ var require_yaml_intelligence_resources = __commonJS({ "Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).", "Manuscript configuration", "internal-schema-hack", - "List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019." + "List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.", + { + short: "The Github repo that will be used to store comments.", + long: "The Github repo that will be used to store comments.\nIn order to work correctly, the repo must be public, with the giscus\napp installed, and the discussions feature must be enabled." + }, + { + short: "The Github repository identifier.", + long: 'The Github repository identifier.\nYou can quickly find this by using the configuration tool at https://giscus.app. If this is not\nprovided, Quarto will attempt to discover it at render time.' + }, + { + short: "The discussion category where new discussions will be created.", + long: "The discussion category where new discussions will be created. It is\nrecommended to use a category with the Announcements\ntype so that new discussions can only be created by maintainers and\ngiscus." + }, + { + short: "The Github category identifier.", + long: 'The Github category identifier.\nYou can quickly find this by using the configuration tool at https://giscus.app. If this is not\nprovided, Quarto will attempt to discover it at render time.' + }, + { + short: "The mapping between the page and the embedded discussion.", + long: "The mapping between the page and the embedded discussion." + }, + "Display reactions for the discussion\u2019s main post before the\ncomments.", + "Specify loading: lazy to defer loading comments until\nthe user scrolls near the comments container.", + "Place the comment input box above or below the comments.", + { + short: "The giscus theme to use when displaying comments.", + long: "The giscus theme to use when displaying comments. Light and dark\nthemes are supported. If a single theme is provided by name, it will be\nused as light and dark theme. To use different themes, use\nlight and dark key:" + }, + "The light theme name.", + "The dark theme name.", + "The language that should be used when displaying the commenting\ninterface.", + "The Github repo that will be used to store comments.", + "The label that will be assigned to issues created by Utterances.", + { + short: "The Github theme that should be used for Utterances.", + long: "The Github theme that should be used for Utterances\n(github-light, github-dark,\ngithub-dark-orange, icy-dark,\ndark-blue, photon-dark,\nbody-light, or gruvbox-dark)" + }, + { + short: "How posts should be mapped to Github issues", + long: "How posts should be mapped to Github issues (pathname,\nurl, title or og:title)" + }, + "Override the default hypothesis client url with a custom client\nurl.", + "Controls whether the sidebar opens automatically on startup.", + "Controls whether the in-document highlights are shown by default\n(always, whenSidebarOpen or\nnever)", + "Controls the overall look of the sidebar (classic or\nclean)", + "Controls whether the experimental New Note button should be shown in\nthe notes tab in the sidebar.", + "Specify a URL to direct a user to, in a new tab. when they click on\nthe annotation author link in the header of an annotation.", + "Alternative annotation services which the client should connect to\ninstead of connecting to the public Hypothesis service at\nhypothes.is.", + "The base URL of the service API.", + "The domain name which the annotation service is associated with.", + "An OAuth 2 grant token which the client can send to the service in\norder to get an access token for making authenticated requests to the\nservice.", + "A flag indicating whether users should be able to leave groups of\nwhich they are a member.", + "A flag indicating whether annotation cards should show links that\ntake the user to see an annotation in context.", + "An array of Group IDs or the literal string\n$rpc:requestGroups", + "The URL to an image for the annotation service. This image will\nappear to the left of the name of the currently selected group.", + "Settings to adjust the commenting sidebar\u2019s look and feel.", + "Secondary color for elements of the commenting UI.", + "The main background color of the commenting UI.", + "The background color for call to action buttons.", + "The font family for selection text in the annotation card.", + "The font family for the actual annotation value that the user writes\nabout the page or selection.", + "A CSS selector specifying the containing element into which the\nsidebar iframe will be placed.", + "Defines a focused filter set for the available annotations on a\npage.", + "The username of the user to focus on.", + "The userid of the user to focus on.", + "The display name of the user to focus on.", + "Host url and port number of receiving iframe", + "Number of nested iframes deep the client is relative from the\nreceiving iframe.", + "The root URL from which assets are loaded.", + "The URL for the sidebar application which displays annotations." ], "schema/external-schemas.yml": [ { @@ -24298,12 +24370,12 @@ var require_yaml_intelligence_resources = __commonJS({ mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 195e3, + _internalId: 194571, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 194992, + _internalId: 194563, type: "enum", enum: [ "png", @@ -24319,7 +24391,7 @@ var require_yaml_intelligence_resources = __commonJS({ exhaustiveCompletions: true }, theme: { - _internalId: 194999, + _internalId: 194570, type: "anyOf", anyOf: [ { diff --git a/src/resources/editor/tools/yaml/web-worker.js b/src/resources/editor/tools/yaml/web-worker.js index 901a8967a2d..7879d298d6e 100644 --- a/src/resources/editor/tools/yaml/web-worker.js +++ b/src/resources/editor/tools/yaml/web-worker.js @@ -8601,7 +8601,127 @@ try { } }, { - id: "comments", + id: "giscus-configuration", + object: { + closed: true, + properties: { + repo: { + string: { + description: { + short: "The Github repo that will be used to store comments.", + long: "The Github repo that will be used to store comments.\n\nIn order to work correctly, the repo must be public, with the giscus app installed, and \nthe discussions feature must be enabled.\n" + } + } + }, + "repo-id": { + string: { + description: { + short: "The Github repository identifier.", + long: "The Github repository identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" + } + } + }, + category: { + string: { + description: { + short: "The discussion category where new discussions will be created.", + long: "The discussion category where new discussions will be created. It is recommended \nto use a category with the **Announcements** type so that new discussions \ncan only be created by maintainers and giscus.\n" + } + } + }, + "category-id": { + string: { + description: { + short: "The Github category identifier.", + long: "The Github category identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" + } + } + }, + mapping: { + anyOf: [ + { + enum: [ + "pathname", + "url", + "title", + "og:title" + ] + }, + "string" + ], + description: { + short: "The mapping between the page and the embedded discussion.", + long: "The mapping between the page and the embedded discussion. \n\n- `pathname`: The discussion title contains the page path\n- `url`: The discussion title contains the page url\n- `title`: The discussion title contains the page title\n- `og:title`: The discussion title contains the `og:title` metadata value\n- any other string or number: Any other strings will be passed through verbatim and a discussion title\ncontaining that value will be used. Numbers will be treated\nas a discussion number and automatic discussion creation is not supported.\n" + } + }, + "reactions-enabled": { + boolean: { + description: "Display reactions for the discussion's main post before the comments." + } + }, + loading: { + enum: [ + "lazy" + ], + description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." + }, + "input-position": { + enum: [ + "top", + "bottom" + ], + description: "Place the comment input box above or below the comments." + }, + theme: { + anyOf: [ + "string", + { + ref: "giscus-themes" + }, + { + object: { + closed: true, + properties: { + light: { + anyOf: [ + "string", + { + ref: "giscus-themes" + } + ], + description: "The light theme name." + }, + dark: { + anyOf: [ + "string", + { + ref: "giscus-themes" + } + ], + description: "The dark theme name." + } + } + } + } + ], + description: { + short: "The giscus theme to use when displaying comments.", + long: "The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: \n\n```yaml\nwebsite:\n comments:\n giscus:\n theme:\n light: light # giscus theme used for light website theme\n dark: dark_dimmed # giscus theme used for dark website theme\n```\n" + } + }, + language: { + string: { + description: "The language that should be used when displaying the commenting interface." + } + } + }, + required: [ + "repo" + ] + } + }, + { + id: "document-comments-configuration", anyOf: [ { enum: [ @@ -8665,123 +8785,7 @@ try { } }, giscus: { - object: { - closed: true, - properties: { - repo: { - string: { - description: { - short: "The Github repo that will be used to store comments.", - long: "The Github repo that will be used to store comments.\n\nIn order to work correctly, the repo must be public, with the giscus app installed, and \nthe discussions feature must be enabled.\n" - } - } - }, - "repo-id": { - string: { - description: { - short: "The Github repository identifier.", - long: "The Github repository identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" - } - } - }, - category: { - string: { - description: { - short: "The discussion category where new discussions will be created.", - long: "The discussion category where new discussions will be created. It is recommended \nto use a category with the **Announcements** type so that new discussions \ncan only be created by maintainers and giscus.\n" - } - } - }, - "category-id": { - string: { - description: { - short: "The Github category identifier.", - long: "The Github category identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" - } - } - }, - mapping: { - anyOf: [ - { - enum: [ - "pathname", - "url", - "title", - "og:title" - ] - }, - "string" - ], - description: { - short: "The mapping between the page and the embedded discussion.", - long: "The mapping between the page and the embedded discussion. \n\n- `pathname`: The discussion title contains the page path\n- `url`: The discussion title contains the page url\n- `title`: The discussion title contains the page title\n- `og:title`: The discussion title contains the `og:title` metadata value\n- any other string or number: Any other strings will be passed through verbatim and a discussion title\ncontaining that value will be used. Numbers will be treated\nas a discussion number and automatic discussion creation is not supported.\n" - } - }, - "reactions-enabled": { - boolean: { - description: "Display reactions for the discussion's main post before the comments." - } - }, - loading: { - enum: [ - "lazy" - ], - description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." - }, - "input-position": { - enum: [ - "top", - "bottom" - ], - description: "Place the comment input box above or below the comments." - }, - theme: { - anyOf: [ - "string", - { - ref: "giscus-themes" - }, - { - object: { - closed: true, - properties: { - light: { - anyOf: [ - "string", - { - ref: "giscus-themes" - } - ], - description: "The light theme name." - }, - dark: { - anyOf: [ - "string", - { - ref: "giscus-themes" - } - ], - description: "The dark theme name." - } - } - } - } - ], - description: { - short: "The giscus theme to use when displaying comments.", - long: "The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: \n\n```yaml\nwebsite:\n comments:\n giscus:\n theme:\n light: light # giscus theme used for light website theme\n dark: dark_dimmed # giscus theme used for dark website theme\n```\n" - } - }, - language: { - string: { - description: "The language that should be used when displaying the commenting interface." - } - } - }, - required: [ - "repo" - ] - } + ref: "giscus-configuration" }, hypothesis: { anyOf: [ @@ -9979,7 +9983,7 @@ try { }, comments: { schema: { - ref: "comments" + ref: "document-comments-configuration" } }, "open-graph": { @@ -13263,7 +13267,7 @@ try { ] }, schema: { - ref: "comments" + ref: "document-comments-configuration" }, description: "Configuration for document commenting." } @@ -22965,7 +22969,6 @@ try { "The light theme name, theme scss file, or a mix of both.", "The dark theme name, theme scss file, or a mix of both.", "The dark theme name, theme scss file, or a mix of both.", - "Array of rendering names, e.g. [light, dark]", "Classes to apply to the body of the document.", "Disables the built in html features like theming, anchor sections,\ncode block behavior, and more.", "Enables inclusion of Pandoc default CSS for this document.", @@ -24070,7 +24073,76 @@ try { "Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).", "Manuscript configuration", "internal-schema-hack", - "List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019." + "List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.", + { + short: "The Github repo that will be used to store comments.", + long: "The Github repo that will be used to store comments.\nIn order to work correctly, the repo must be public, with the giscus\napp installed, and the discussions feature must be enabled." + }, + { + short: "The Github repository identifier.", + long: 'The Github repository identifier.\nYou can quickly find this by using the configuration tool at https://giscus.app. If this is not\nprovided, Quarto will attempt to discover it at render time.' + }, + { + short: "The discussion category where new discussions will be created.", + long: "The discussion category where new discussions will be created. It is\nrecommended to use a category with the Announcements\ntype so that new discussions can only be created by maintainers and\ngiscus." + }, + { + short: "The Github category identifier.", + long: 'The Github category identifier.\nYou can quickly find this by using the configuration tool at https://giscus.app. If this is not\nprovided, Quarto will attempt to discover it at render time.' + }, + { + short: "The mapping between the page and the embedded discussion.", + long: "The mapping between the page and the embedded discussion." + }, + "Display reactions for the discussion\u2019s main post before the\ncomments.", + "Specify loading: lazy to defer loading comments until\nthe user scrolls near the comments container.", + "Place the comment input box above or below the comments.", + { + short: "The giscus theme to use when displaying comments.", + long: "The giscus theme to use when displaying comments. Light and dark\nthemes are supported. If a single theme is provided by name, it will be\nused as light and dark theme. To use different themes, use\nlight and dark key:" + }, + "The light theme name.", + "The dark theme name.", + "The language that should be used when displaying the commenting\ninterface.", + "The Github repo that will be used to store comments.", + "The label that will be assigned to issues created by Utterances.", + { + short: "The Github theme that should be used for Utterances.", + long: "The Github theme that should be used for Utterances\n(github-light, github-dark,\ngithub-dark-orange, icy-dark,\ndark-blue, photon-dark,\nbody-light, or gruvbox-dark)" + }, + { + short: "How posts should be mapped to Github issues", + long: "How posts should be mapped to Github issues (pathname,\nurl, title or og:title)" + }, + "Override the default hypothesis client url with a custom client\nurl.", + "Controls whether the sidebar opens automatically on startup.", + "Controls whether the in-document highlights are shown by default\n(always, whenSidebarOpen or\nnever)", + "Controls the overall look of the sidebar (classic or\nclean)", + "Controls whether the experimental New Note button should be shown in\nthe notes tab in the sidebar.", + "Specify a URL to direct a user to, in a new tab. when they click on\nthe annotation author link in the header of an annotation.", + "Alternative annotation services which the client should connect to\ninstead of connecting to the public Hypothesis service at\nhypothes.is.", + "The base URL of the service API.", + "The domain name which the annotation service is associated with.", + "An OAuth 2 grant token which the client can send to the service in\norder to get an access token for making authenticated requests to the\nservice.", + "A flag indicating whether users should be able to leave groups of\nwhich they are a member.", + "A flag indicating whether annotation cards should show links that\ntake the user to see an annotation in context.", + "An array of Group IDs or the literal string\n$rpc:requestGroups", + "The URL to an image for the annotation service. This image will\nappear to the left of the name of the currently selected group.", + "Settings to adjust the commenting sidebar\u2019s look and feel.", + "Secondary color for elements of the commenting UI.", + "The main background color of the commenting UI.", + "The background color for call to action buttons.", + "The font family for selection text in the annotation card.", + "The font family for the actual annotation value that the user writes\nabout the page or selection.", + "A CSS selector specifying the containing element into which the\nsidebar iframe will be placed.", + "Defines a focused filter set for the available annotations on a\npage.", + "The username of the user to focus on.", + "The userid of the user to focus on.", + "The display name of the user to focus on.", + "Host url and port number of receiving iframe", + "Number of nested iframes deep the client is relative from the\nreceiving iframe.", + "The root URL from which assets are loaded.", + "The URL for the sidebar application which displays annotations." ], "schema/external-schemas.yml": [ { @@ -24299,12 +24371,12 @@ try { mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 195e3, + _internalId: 194571, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 194992, + _internalId: 194563, type: "enum", enum: [ "png", @@ -24320,7 +24392,7 @@ try { exhaustiveCompletions: true }, theme: { - _internalId: 194999, + _internalId: 194570, type: "anyOf", anyOf: [ { diff --git a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json index 0a08dee8449..1e94fb292f2 100644 --- a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json +++ b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json @@ -1572,7 +1572,127 @@ } }, { - "id": "comments", + "id": "giscus-configuration", + "object": { + "closed": true, + "properties": { + "repo": { + "string": { + "description": { + "short": "The Github repo that will be used to store comments.", + "long": "The Github repo that will be used to store comments.\n\nIn order to work correctly, the repo must be public, with the giscus app installed, and \nthe discussions feature must be enabled.\n" + } + } + }, + "repo-id": { + "string": { + "description": { + "short": "The Github repository identifier.", + "long": "The Github repository identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" + } + } + }, + "category": { + "string": { + "description": { + "short": "The discussion category where new discussions will be created.", + "long": "The discussion category where new discussions will be created. It is recommended \nto use a category with the **Announcements** type so that new discussions \ncan only be created by maintainers and giscus.\n" + } + } + }, + "category-id": { + "string": { + "description": { + "short": "The Github category identifier.", + "long": "The Github category identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" + } + } + }, + "mapping": { + "anyOf": [ + { + "enum": [ + "pathname", + "url", + "title", + "og:title" + ] + }, + "string" + ], + "description": { + "short": "The mapping between the page and the embedded discussion.", + "long": "The mapping between the page and the embedded discussion. \n\n- `pathname`: The discussion title contains the page path\n- `url`: The discussion title contains the page url\n- `title`: The discussion title contains the page title\n- `og:title`: The discussion title contains the `og:title` metadata value\n- any other string or number: Any other strings will be passed through verbatim and a discussion title\ncontaining that value will be used. Numbers will be treated\nas a discussion number and automatic discussion creation is not supported.\n" + } + }, + "reactions-enabled": { + "boolean": { + "description": "Display reactions for the discussion's main post before the comments." + } + }, + "loading": { + "enum": [ + "lazy" + ], + "description": "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." + }, + "input-position": { + "enum": [ + "top", + "bottom" + ], + "description": "Place the comment input box above or below the comments." + }, + "theme": { + "anyOf": [ + "string", + { + "ref": "giscus-themes" + }, + { + "object": { + "closed": true, + "properties": { + "light": { + "anyOf": [ + "string", + { + "ref": "giscus-themes" + } + ], + "description": "The light theme name." + }, + "dark": { + "anyOf": [ + "string", + { + "ref": "giscus-themes" + } + ], + "description": "The dark theme name." + } + } + } + } + ], + "description": { + "short": "The giscus theme to use when displaying comments.", + "long": "The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: \n\n```yaml\nwebsite:\n comments:\n giscus:\n theme:\n light: light # giscus theme used for light website theme\n dark: dark_dimmed # giscus theme used for dark website theme\n```\n" + } + }, + "language": { + "string": { + "description": "The language that should be used when displaying the commenting interface." + } + } + }, + "required": [ + "repo" + ] + } + }, + { + "id": "document-comments-configuration", "anyOf": [ { "enum": [ @@ -1636,123 +1756,7 @@ } }, "giscus": { - "object": { - "closed": true, - "properties": { - "repo": { - "string": { - "description": { - "short": "The Github repo that will be used to store comments.", - "long": "The Github repo that will be used to store comments.\n\nIn order to work correctly, the repo must be public, with the giscus app installed, and \nthe discussions feature must be enabled.\n" - } - } - }, - "repo-id": { - "string": { - "description": { - "short": "The Github repository identifier.", - "long": "The Github repository identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" - } - } - }, - "category": { - "string": { - "description": { - "short": "The discussion category where new discussions will be created.", - "long": "The discussion category where new discussions will be created. It is recommended \nto use a category with the **Announcements** type so that new discussions \ncan only be created by maintainers and giscus.\n" - } - } - }, - "category-id": { - "string": { - "description": { - "short": "The Github category identifier.", - "long": "The Github category identifier.\n\nYou can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).\nIf this is not provided, Quarto will attempt to discover it at render time.\n" - } - } - }, - "mapping": { - "anyOf": [ - { - "enum": [ - "pathname", - "url", - "title", - "og:title" - ] - }, - "string" - ], - "description": { - "short": "The mapping between the page and the embedded discussion.", - "long": "The mapping between the page and the embedded discussion. \n\n- `pathname`: The discussion title contains the page path\n- `url`: The discussion title contains the page url\n- `title`: The discussion title contains the page title\n- `og:title`: The discussion title contains the `og:title` metadata value\n- any other string or number: Any other strings will be passed through verbatim and a discussion title\ncontaining that value will be used. Numbers will be treated\nas a discussion number and automatic discussion creation is not supported.\n" - } - }, - "reactions-enabled": { - "boolean": { - "description": "Display reactions for the discussion's main post before the comments." - } - }, - "loading": { - "enum": [ - "lazy" - ], - "description": "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." - }, - "input-position": { - "enum": [ - "top", - "bottom" - ], - "description": "Place the comment input box above or below the comments." - }, - "theme": { - "anyOf": [ - "string", - { - "ref": "giscus-themes" - }, - { - "object": { - "closed": true, - "properties": { - "light": { - "anyOf": [ - "string", - { - "ref": "giscus-themes" - } - ], - "description": "The light theme name." - }, - "dark": { - "anyOf": [ - "string", - { - "ref": "giscus-themes" - } - ], - "description": "The dark theme name." - } - } - } - } - ], - "description": { - "short": "The giscus theme to use when displaying comments.", - "long": "The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: \n\n```yaml\nwebsite:\n comments:\n giscus:\n theme:\n light: light # giscus theme used for light website theme\n dark: dark_dimmed # giscus theme used for dark website theme\n```\n" - } - }, - "language": { - "string": { - "description": "The language that should be used when displaying the commenting interface." - } - } - }, - "required": [ - "repo" - ] - } + "ref": "giscus-configuration" }, "hypothesis": { "anyOf": [ @@ -2950,7 +2954,7 @@ }, "comments": { "schema": { - "ref": "comments" + "ref": "document-comments-configuration" } }, "open-graph": { @@ -6234,7 +6238,7 @@ ] }, "schema": { - "ref": "comments" + "ref": "document-comments-configuration" }, "description": "Configuration for document commenting." } @@ -15936,7 +15940,6 @@ "The light theme name, theme scss file, or a mix of both.", "The dark theme name, theme scss file, or a mix of both.", "The dark theme name, theme scss file, or a mix of both.", - "Array of rendering names, e.g. [light, dark]", "Classes to apply to the body of the document.", "Disables the built in html features like theming, anchor sections,\ncode block behavior, and more.", "Enables inclusion of Pandoc default CSS for this document.", @@ -17041,7 +17044,76 @@ "Disambiguating year suffix in author-date styles (e.g. “a” in “Doe,\n1999a”).", "Manuscript configuration", "internal-schema-hack", - "List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’." + "List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’.", + { + "short": "The Github repo that will be used to store comments.", + "long": "The Github repo that will be used to store comments.\nIn order to work correctly, the repo must be public, with the giscus\napp installed, and the discussions feature must be enabled." + }, + { + "short": "The Github repository identifier.", + "long": "The Github repository identifier.\nYou can quickly find this by using the configuration tool at https://giscus.app. If this is not\nprovided, Quarto will attempt to discover it at render time." + }, + { + "short": "The discussion category where new discussions will be created.", + "long": "The discussion category where new discussions will be created. It is\nrecommended to use a category with the Announcements\ntype so that new discussions can only be created by maintainers and\ngiscus." + }, + { + "short": "The Github category identifier.", + "long": "The Github category identifier.\nYou can quickly find this by using the configuration tool at https://giscus.app. If this is not\nprovided, Quarto will attempt to discover it at render time." + }, + { + "short": "The mapping between the page and the embedded discussion.", + "long": "The mapping between the page and the embedded discussion." + }, + "Display reactions for the discussion’s main post before the\ncomments.", + "Specify loading: lazy to defer loading comments until\nthe user scrolls near the comments container.", + "Place the comment input box above or below the comments.", + { + "short": "The giscus theme to use when displaying comments.", + "long": "The giscus theme to use when displaying comments. Light and dark\nthemes are supported. If a single theme is provided by name, it will be\nused as light and dark theme. To use different themes, use\nlight and dark key:" + }, + "The light theme name.", + "The dark theme name.", + "The language that should be used when displaying the commenting\ninterface.", + "The Github repo that will be used to store comments.", + "The label that will be assigned to issues created by Utterances.", + { + "short": "The Github theme that should be used for Utterances.", + "long": "The Github theme that should be used for Utterances\n(github-light, github-dark,\ngithub-dark-orange, icy-dark,\ndark-blue, photon-dark,\nbody-light, or gruvbox-dark)" + }, + { + "short": "How posts should be mapped to Github issues", + "long": "How posts should be mapped to Github issues (pathname,\nurl, title or og:title)" + }, + "Override the default hypothesis client url with a custom client\nurl.", + "Controls whether the sidebar opens automatically on startup.", + "Controls whether the in-document highlights are shown by default\n(always, whenSidebarOpen or\nnever)", + "Controls the overall look of the sidebar (classic or\nclean)", + "Controls whether the experimental New Note button should be shown in\nthe notes tab in the sidebar.", + "Specify a URL to direct a user to, in a new tab. when they click on\nthe annotation author link in the header of an annotation.", + "Alternative annotation services which the client should connect to\ninstead of connecting to the public Hypothesis service at\nhypothes.is.", + "The base URL of the service API.", + "The domain name which the annotation service is associated with.", + "An OAuth 2 grant token which the client can send to the service in\norder to get an access token for making authenticated requests to the\nservice.", + "A flag indicating whether users should be able to leave groups of\nwhich they are a member.", + "A flag indicating whether annotation cards should show links that\ntake the user to see an annotation in context.", + "An array of Group IDs or the literal string\n$rpc:requestGroups", + "The URL to an image for the annotation service. This image will\nappear to the left of the name of the currently selected group.", + "Settings to adjust the commenting sidebar’s look and feel.", + "Secondary color for elements of the commenting UI.", + "The main background color of the commenting UI.", + "The background color for call to action buttons.", + "The font family for selection text in the annotation card.", + "The font family for the actual annotation value that the user writes\nabout the page or selection.", + "A CSS selector specifying the containing element into which the\nsidebar iframe will be placed.", + "Defines a focused filter set for the available annotations on a\npage.", + "The username of the user to focus on.", + "The userid of the user to focus on.", + "The display name of the user to focus on.", + "Host url and port number of receiving iframe", + "Number of nested iframes deep the client is relative from the\nreceiving iframe.", + "The root URL from which assets are loaded.", + "The URL for the sidebar application which displays annotations." ], "schema/external-schemas.yml": [ { @@ -17270,12 +17342,12 @@ "mermaid": "%%" }, "handlers/mermaid/schema.yml": { - "_internalId": 195000, + "_internalId": 194571, "type": "object", "description": "be an object", "properties": { "mermaid-format": { - "_internalId": 194992, + "_internalId": 194563, "type": "enum", "enum": [ "png", @@ -17291,7 +17363,7 @@ "exhaustiveCompletions": true }, "theme": { - "_internalId": 194999, + "_internalId": 194570, "type": "anyOf", "anyOf": [ { diff --git a/src/resources/schema/definitions.yml b/src/resources/schema/definitions.yml index 6aa7c641924..b8b8f9f5f1e 100644 --- a/src/resources/schema/definitions.yml +++ b/src/resources/schema/definitions.yml @@ -178,7 +178,107 @@ preferred_color_scheme, ] -- id: comments +- id: giscus-configuration + object: + closed: true + properties: + repo: + string: + description: + short: The Github repo that will be used to store comments. + long: | + The Github repo that will be used to store comments. + + In order to work correctly, the repo must be public, with the giscus app installed, and + the discussions feature must be enabled. + repo-id: + string: + description: + short: The Github repository identifier. + long: | + The Github repository identifier. + + You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app). + If this is not provided, Quarto will attempt to discover it at render time. + category: + string: + description: + short: The discussion category where new discussions will be created. + long: | + The discussion category where new discussions will be created. It is recommended + to use a category with the **Announcements** type so that new discussions + can only be created by maintainers and giscus. + category-id: + string: + description: + short: The Github category identifier. + long: | + The Github category identifier. + + You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app). + If this is not provided, Quarto will attempt to discover it at render time. + mapping: + anyOf: + - enum: [pathname, url, title, og:title] + - string + description: + short: The mapping between the page and the embedded discussion. + long: | + The mapping between the page and the embedded discussion. + + - `pathname`: The discussion title contains the page path + - `url`: The discussion title contains the page url + - `title`: The discussion title contains the page title + - `og:title`: The discussion title contains the `og:title` metadata value + - any other string or number: Any other strings will be passed through verbatim and a discussion title + containing that value will be used. Numbers will be treated + as a discussion number and automatic discussion creation is not supported. + reactions-enabled: + boolean: + description: Display reactions for the discussion's main post before the comments. + loading: + enum: [lazy] + description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." + input-position: + enum: [top, bottom] + description: Place the comment input box above or below the comments. + theme: + anyOf: + - string + - ref: giscus-themes + - object: + closed: true + properties: + light: + anyOf: + - string + - ref: giscus-themes + description: The light theme name. + dark: + anyOf: + - string + - ref: giscus-themes + description: The dark theme name. + + description: + short: The giscus theme to use when displaying comments. + long: | + The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: + + ```yaml + website: + comments: + giscus: + theme: + light: light # giscus theme used for light website theme + dark: dark_dimmed # giscus theme used for dark website theme + ``` + language: + string: + description: The language that should be used when displaying the commenting interface. + required: [repo] + +- id: document-comments-configuration anyOf: - enum: [false] - object: @@ -226,104 +326,7 @@ - og:title required: [repo] giscus: - object: - closed: true - properties: - repo: - string: - description: - short: The Github repo that will be used to store comments. - long: | - The Github repo that will be used to store comments. - - In order to work correctly, the repo must be public, with the giscus app installed, and - the discussions feature must be enabled. - repo-id: - string: - description: - short: The Github repository identifier. - long: | - The Github repository identifier. - - You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app). - If this is not provided, Quarto will attempt to discover it at render time. - category: - string: - description: - short: The discussion category where new discussions will be created. - long: | - The discussion category where new discussions will be created. It is recommended - to use a category with the **Announcements** type so that new discussions - can only be created by maintainers and giscus. - category-id: - string: - description: - short: The Github category identifier. - long: | - The Github category identifier. - - You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app). - If this is not provided, Quarto will attempt to discover it at render time. - mapping: - anyOf: - - enum: [pathname, url, title, og:title] - - string - description: - short: The mapping between the page and the embedded discussion. - long: | - The mapping between the page and the embedded discussion. - - - `pathname`: The discussion title contains the page path - - `url`: The discussion title contains the page url - - `title`: The discussion title contains the page title - - `og:title`: The discussion title contains the `og:title` metadata value - - any other string or number: Any other strings will be passed through verbatim and a discussion title - containing that value will be used. Numbers will be treated - as a discussion number and automatic discussion creation is not supported. - reactions-enabled: - boolean: - description: Display reactions for the discussion's main post before the comments. - loading: - enum: [lazy] - description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container." - input-position: - enum: [top, bottom] - description: Place the comment input box above or below the comments. - theme: - anyOf: - - string - - ref: giscus-themes - - object: - closed: true - properties: - light: - anyOf: - - string - - ref: giscus-themes - description: The light theme name. - dark: - anyOf: - - string - - ref: giscus-themes - description: The dark theme name. - - description: - short: The giscus theme to use when displaying comments. - long: | - The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: - - ```yaml - website: - comments: - giscus: - theme: - light: light # giscus theme used for light website theme - dark: dark_dimmed # giscus theme used for dark website theme - ``` - language: - string: - description: The language that should be used when displaying the commenting interface. - required: [repo] + ref: giscus-configuration hypothesis: anyOf: - boolean @@ -1121,7 +1124,7 @@ Default site thumbnail image alt text for `twitter` /`open-graph` comments: schema: - ref: comments + ref: document-comments-configuration open-graph: anyOf: diff --git a/src/resources/schema/document-comments.yml b/src/resources/schema/document-comments.yml index 409261f6d5f..060893556f3 100644 --- a/src/resources/schema/document-comments.yml +++ b/src/resources/schema/document-comments.yml @@ -2,5 +2,5 @@ tags: formats: [$html-files] schema: - ref: comments + ref: document-comments-configuration description: Configuration for document commenting. diff --git a/src/resources/schema/json-schemas.json b/src/resources/schema/json-schemas.json index f4370923cd2..bcc3568bb07 100644 --- a/src/resources/schema/json-schemas.json +++ b/src/resources/schema/json-schemas.json @@ -240,7 +240,93 @@ ] } }, - "Comments": { + "GiscusConfiguration": { + "object": { + "properties": { + "repo": { + "type": "string" + }, + "repo-id": { + "type": "string" + }, + "category": { + "type": "string" + }, + "category-id": { + "type": "string" + }, + "mapping": { + "anyOf": [ + { + "enum": [ + "pathname", + "url", + "title", + "og:title" + ] + }, + { + "type": "string" + } + ] + }, + "reactions-enabled": { + "type": "boolean" + }, + "loading": { + "enum": [ + "lazy" + ] + }, + "input-position": { + "enum": [ + "top", + "bottom" + ] + }, + "theme": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/GiscusThemes" + }, + { + "object": { + "properties": { + "light": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/GiscusThemes" + } + ] + }, + "dark": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/GiscusThemes" + } + ] + } + } + } + } + ] + }, + "language": { + "type": "string" + } + } + } + }, + "DocumentCommentsConfiguration": { "anyOf": [ { "enum": [ @@ -269,90 +355,7 @@ } }, "giscus": { - "object": { - "properties": { - "repo": { - "type": "string" - }, - "repo-id": { - "type": "string" - }, - "category": { - "type": "string" - }, - "category-id": { - "type": "string" - }, - "mapping": { - "anyOf": [ - { - "enum": [ - "pathname", - "url", - "title", - "og:title" - ] - }, - { - "type": "string" - } - ] - }, - "reactions-enabled": { - "type": "boolean" - }, - "loading": { - "enum": [ - "lazy" - ] - }, - "input-position": { - "enum": [ - "top", - "bottom" - ] - }, - "theme": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/$defs/GiscusThemes" - }, - { - "object": { - "properties": { - "light": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/$defs/GiscusThemes" - } - ] - }, - "dark": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/$defs/GiscusThemes" - } - ] - } - } - } - } - ] - }, - "language": { - "type": "string" - } - } - } + "$ref": "#/$defs/GiscusConfiguration" }, "hypothesis": { "anyOf": [ @@ -1447,7 +1450,7 @@ "type": "string" }, "comments": { - "$ref": "#/$defs/Comments" + "$ref": "#/$defs/DocumentCommentsConfiguration" }, "open-graph": { "anyOf": [ diff --git a/src/resources/types/schema-types.ts b/src/resources/types/schema-types.ts index 0b71fd55794..583f7fa7e92 100644 --- a/src/resources/types/schema-types.ts +++ b/src/resources/types/schema-types.ts @@ -111,31 +111,30 @@ export type GiscusThemes = | "noborder_gray" | "preferred_color_scheme"; -export type Comments = false | { - giscus?: { - "repo-id"?: string /* The Github repository identifier. +export type GiscusConfiguration = { + "repo-id"?: string /* The Github repository identifier. You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app). If this is not provided, Quarto will attempt to discover it at render time. */; - "category-id"?: string /* The Github category identifier. + "category-id"?: string /* The Github category identifier. You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app). If this is not provided, Quarto will attempt to discover it at render time. */; - "reactions-enabled"?: - boolean /* Display reactions for the discussion's main post before the comments. */; - "input-position"?: - | "top" - | "bottom" /* Place the comment input box above or below the comments. */; - category?: - string /* The discussion category where new discussions will be created. It is recommended + "reactions-enabled"?: + boolean /* Display reactions for the discussion's main post before the comments. */; + "input-position"?: + | "top" + | "bottom" /* Place the comment input box above or below the comments. */; + category?: + string /* The discussion category where new discussions will be created. It is recommended to use a category with the **Announcements** type so that new discussions can only be created by maintainers and giscus. */; - loading?: "lazy"; - language?: - string /* The language that should be used when displaying the commenting interface. */; - mapping?: - | ("pathname" | "url" | "title" | "og:title") - | string /* The mapping between the page and the embedded discussion. + loading?: "lazy"; + language?: + string /* The language that should be used when displaying the commenting interface. */; + mapping?: + | ("pathname" | "url" | "title" | "og:title") + | string /* The mapping between the page and the embedded discussion. - `pathname`: The discussion title contains the page path - `url`: The discussion title contains the page url @@ -144,14 +143,14 @@ can only be created by maintainers and giscus. */; - any other string or number: Any other strings will be passed through verbatim and a discussion title containing that value will be used. Numbers will be treated as a discussion number and automatic discussion creation is not supported. */; - repo: string /* The Github repo that will be used to store comments. + repo: string /* The Github repo that will be used to store comments. In order to work correctly, the repo must be public, with the giscus app installed, and the discussions feature must be enabled. */; - theme?: string | GiscusThemes | { - dark?: string | GiscusThemes /* The dark theme name. */; - light?: string | GiscusThemes; /* The light theme name. */ - }; /* The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: + theme?: string | GiscusThemes | { + dark?: string | GiscusThemes /* The dark theme name. */; + light?: string | GiscusThemes; /* The light theme name. */ + }; /* The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use `light` and `dark` key: ```yaml website: @@ -161,7 +160,10 @@ website: light: light # giscus theme used for light website theme dark: dark_dimmed # giscus theme used for dark website theme ``` */ - }; +}; + +export type DocumentCommentsConfiguration = false | { + giscus?: GiscusConfiguration; hypothesis?: boolean | { "client-url"?: string /* Override the default hypothesis client url with a custom client url. */; @@ -454,7 +456,7 @@ The user’s cookie preferences will automatically control Google Analytics (if | "light" | "dark"; } /* Provides an announcement displayed at the top of the page. */; - comments?: Comments; + comments?: DocumentCommentsConfiguration; description?: string /* Website description */; drafts?: MaybeArrayOf; favicon?: string /* The path to the favicon for this website */;