Skip to content

Commit d846f20

Browse files
committed
types - pull comments configuration into definition, use right type
1 parent b01dea7 commit d846f20

File tree

8 files changed

+751
-613
lines changed

8 files changed

+751
-613
lines changed

src/project/types/website/website-giscus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export async function resolveFormatForGiscus(
3232
) {
3333
const comments = format.metadata[kComments] as
3434
| Record<string, unknown>
35+
| false
3536
| undefined;
3637
if (!comments) return;
3738

src/resources/editor/tools/vs-code.mjs

Lines changed: 177 additions & 134 deletions
Large diffs are not rendered by default.

src/resources/editor/tools/yaml/web-worker.js

Lines changed: 177 additions & 134 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/editor/tools/yaml/yaml-intelligence-resources.json

Lines changed: 177 additions & 134 deletions
Large diffs are not rendered by default.

src/resources/schema/definitions.yml

Lines changed: 103 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,107 @@
178178
preferred_color_scheme,
179179
]
180180

181-
- id: comments
181+
- id: giscus-configuration
182+
object:
183+
closed: true
184+
properties:
185+
repo:
186+
string:
187+
description:
188+
short: The Github repo that will be used to store comments.
189+
long: |
190+
The Github repo that will be used to store comments.
191+
192+
In order to work correctly, the repo must be public, with the giscus app installed, and
193+
the discussions feature must be enabled.
194+
repo-id:
195+
string:
196+
description:
197+
short: The Github repository identifier.
198+
long: |
199+
The Github repository identifier.
200+
201+
You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).
202+
If this is not provided, Quarto will attempt to discover it at render time.
203+
category:
204+
string:
205+
description:
206+
short: The discussion category where new discussions will be created.
207+
long: |
208+
The discussion category where new discussions will be created. It is recommended
209+
to use a category with the **Announcements** type so that new discussions
210+
can only be created by maintainers and giscus.
211+
category-id:
212+
string:
213+
description:
214+
short: The Github category identifier.
215+
long: |
216+
The Github category identifier.
217+
218+
You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).
219+
If this is not provided, Quarto will attempt to discover it at render time.
220+
mapping:
221+
anyOf:
222+
- enum: [pathname, url, title, og:title]
223+
- string
224+
description:
225+
short: The mapping between the page and the embedded discussion.
226+
long: |
227+
The mapping between the page and the embedded discussion.
228+
229+
- `pathname`: The discussion title contains the page path
230+
- `url`: The discussion title contains the page url
231+
- `title`: The discussion title contains the page title
232+
- `og:title`: The discussion title contains the `og:title` metadata value
233+
- any other string or number: Any other strings will be passed through verbatim and a discussion title
234+
containing that value will be used. Numbers will be treated
235+
as a discussion number and automatic discussion creation is not supported.
236+
reactions-enabled:
237+
boolean:
238+
description: Display reactions for the discussion's main post before the comments.
239+
loading:
240+
enum: [lazy]
241+
description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container."
242+
input-position:
243+
enum: [top, bottom]
244+
description: Place the comment input box above or below the comments.
245+
theme:
246+
anyOf:
247+
- string
248+
- ref: giscus-themes
249+
- object:
250+
closed: true
251+
properties:
252+
light:
253+
anyOf:
254+
- string
255+
- ref: giscus-themes
256+
description: The light theme name.
257+
dark:
258+
anyOf:
259+
- string
260+
- ref: giscus-themes
261+
description: The dark theme name.
262+
263+
description:
264+
short: The giscus theme to use when displaying comments.
265+
long: |
266+
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:
267+
268+
```yaml
269+
website:
270+
comments:
271+
giscus:
272+
theme:
273+
light: light # giscus theme used for light website theme
274+
dark: dark_dimmed # giscus theme used for dark website theme
275+
```
276+
language:
277+
string:
278+
description: The language that should be used when displaying the commenting interface.
279+
required: [repo]
280+
281+
- id: document-comments-configuration
182282
anyOf:
183283
- enum: [false]
184284
- object:
@@ -226,104 +326,7 @@
226326
- og:title
227327
required: [repo]
228328
giscus:
229-
object:
230-
closed: true
231-
properties:
232-
repo:
233-
string:
234-
description:
235-
short: The Github repo that will be used to store comments.
236-
long: |
237-
The Github repo that will be used to store comments.
238-
239-
In order to work correctly, the repo must be public, with the giscus app installed, and
240-
the discussions feature must be enabled.
241-
repo-id:
242-
string:
243-
description:
244-
short: The Github repository identifier.
245-
long: |
246-
The Github repository identifier.
247-
248-
You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).
249-
If this is not provided, Quarto will attempt to discover it at render time.
250-
category:
251-
string:
252-
description:
253-
short: The discussion category where new discussions will be created.
254-
long: |
255-
The discussion category where new discussions will be created. It is recommended
256-
to use a category with the **Announcements** type so that new discussions
257-
can only be created by maintainers and giscus.
258-
category-id:
259-
string:
260-
description:
261-
short: The Github category identifier.
262-
long: |
263-
The Github category identifier.
264-
265-
You can quickly find this by using the configuration tool at [https://giscus.app](https://giscus.app).
266-
If this is not provided, Quarto will attempt to discover it at render time.
267-
mapping:
268-
anyOf:
269-
- enum: [pathname, url, title, og:title]
270-
- string
271-
description:
272-
short: The mapping between the page and the embedded discussion.
273-
long: |
274-
The mapping between the page and the embedded discussion.
275-
276-
- `pathname`: The discussion title contains the page path
277-
- `url`: The discussion title contains the page url
278-
- `title`: The discussion title contains the page title
279-
- `og:title`: The discussion title contains the `og:title` metadata value
280-
- any other string or number: Any other strings will be passed through verbatim and a discussion title
281-
containing that value will be used. Numbers will be treated
282-
as a discussion number and automatic discussion creation is not supported.
283-
reactions-enabled:
284-
boolean:
285-
description: Display reactions for the discussion's main post before the comments.
286-
loading:
287-
enum: [lazy]
288-
description: "Specify `loading: lazy` to defer loading comments until the user scrolls near the comments container."
289-
input-position:
290-
enum: [top, bottom]
291-
description: Place the comment input box above or below the comments.
292-
theme:
293-
anyOf:
294-
- string
295-
- ref: giscus-themes
296-
- object:
297-
closed: true
298-
properties:
299-
light:
300-
anyOf:
301-
- string
302-
- ref: giscus-themes
303-
description: The light theme name.
304-
dark:
305-
anyOf:
306-
- string
307-
- ref: giscus-themes
308-
description: The dark theme name.
309-
310-
description:
311-
short: The giscus theme to use when displaying comments.
312-
long: |
313-
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:
314-
315-
```yaml
316-
website:
317-
comments:
318-
giscus:
319-
theme:
320-
light: light # giscus theme used for light website theme
321-
dark: dark_dimmed # giscus theme used for dark website theme
322-
```
323-
language:
324-
string:
325-
description: The language that should be used when displaying the commenting interface.
326-
required: [repo]
329+
ref: giscus-configuration
327330
hypothesis:
328331
anyOf:
329332
- boolean
@@ -1121,7 +1124,7 @@
11211124
Default site thumbnail image alt text for `twitter` /`open-graph`
11221125
comments:
11231126
schema:
1124-
ref: comments
1127+
ref: document-comments-configuration
11251128

11261129
open-graph:
11271130
anyOf:

src/resources/schema/document-comments.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
tags:
33
formats: [$html-files]
44
schema:
5-
ref: comments
5+
ref: document-comments-configuration
66
description: Configuration for document commenting.

0 commit comments

Comments
 (0)