Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from "../project/types.ts";

import {
basename,
dirname,
isAbsolute,
join,
Expand Down Expand Up @@ -158,7 +159,10 @@ export function projectExtensionPathResolver(
return (href: string, projectOffset: string) => {
const projectRelativeHref = relative(projectOffset, href);

if (projectRelativeHref.startsWith("_extensions/") || projectRelativeHref.startsWith("_extensions\\")) {
if (
projectRelativeHref.startsWith("_extensions/") ||
projectRelativeHref.startsWith("_extensions\\")
) {
const projectTargetHref = projectRelativeHref.replace(
/^_extensions/,
`${libDir}/quarto-contrib/quarto-project`,
Expand Down Expand Up @@ -809,10 +813,18 @@ async function readExtension(
);
if (resolved.include.length > 0) {
if (key === "brand") {
(object.project as Record<string, unknown>)[key] = relative(
join(extensionDir, "..", ".."),
resolved.include[0],
);
let projectDir = extensionDir, last;
do {
last = basename(projectDir);
projectDir = dirname(projectDir);
} while (projectDir && last !== "_extensions");
if (projectDir) {
(object.project as Record<string, unknown>)[key] = relative(
projectDir,
resolved.include[0],
);
console.log("aslfjasf", projectDir, object.project);
}
} else {
(object.project as Record<string, unknown>)[key] = resolved.include;
}
Expand Down
31 changes: 25 additions & 6 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13050,6 +13050,22 @@ var require_yaml_intelligence_resources = __commonJS({
}
}
},
{
id: "brand-path-only-light-dark",
anyOf: [
"string",
{
object: {
closed: true,
properties: {
light: "string",
dark: "string"
}
}
}
],
description: "A path to a brand.yml file, or an object with light and dark paths to brand.yml\n"
},
{
id: "brand-path-bool-light-dark",
anyOf: [
Expand Down Expand Up @@ -20452,9 +20468,9 @@ var require_yaml_intelligence_resources = __commonJS({
},
brand: {
schema: {
ref: "brand-path-bool-light-dark"
ref: "brand-path-only-light-dark"
},
description: "Branding information to use for this document. If a string, the path to a brand file.\nIf false, don't use branding on this document. If an object, an inline brand\ndefinition, or an object with light and dark brand paths or definitions.\n"
description: "Path to brand.yml or object with light and dark paths to brand.yml\n"
},
preview: {
description: "Options for `quarto preview`",
Expand Down Expand Up @@ -23995,6 +24011,7 @@ var require_yaml_intelligence_resources = __commonJS({
"HTML library (JS/CSS/etc.) directory",
"Additional file resources to be copied to output directory",
"Additional file resources to be copied to output directory",
"Branding information to use for this document. If a string, the path\nto a brand file. If false, don\u2019t use branding on this document. If an\nobject, an inline brand definition, or an object with light and dark\nbrand paths or definitions.",
"Options for <code>quarto preview</code>",
"Scripts to run as a pre-render step",
"Scripts to run as a post-render step",
Expand Down Expand Up @@ -24344,6 +24361,7 @@ var require_yaml_intelligence_resources = __commonJS({
"HTML library (JS/CSS/etc.) directory",
"Additional file resources to be copied to output directory",
"Additional file resources to be copied to output directory",
"Branding information to use for this document. If a string, the path\nto a brand file. If false, don\u2019t use branding on this document. If an\nobject, an inline brand definition, or an object with light and dark\nbrand paths or definitions.",
"Options for <code>quarto preview</code>",
"Scripts to run as a pre-render step",
"Scripts to run as a post-render step",
Expand Down Expand Up @@ -24678,7 +24696,8 @@ var require_yaml_intelligence_resources = __commonJS({
"Disambiguating year suffix in author-date styles (e.g.&nbsp;\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.",
"A path to a brand.yml file, or an object with light and dark paths to\nbrand.yml"
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -24907,12 +24926,12 @@ var require_yaml_intelligence_resources = __commonJS({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
_internalId: 197505,
_internalId: 197527,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
_internalId: 197497,
_internalId: 197519,
type: "enum",
enum: [
"png",
Expand All @@ -24928,7 +24947,7 @@ var require_yaml_intelligence_resources = __commonJS({
exhaustiveCompletions: true
},
theme: {
_internalId: 197504,
_internalId: 197526,
type: "anyOf",
anyOf: [
{
Expand Down

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions src/resources/editor/tools/yaml/web-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 25 additions & 6 deletions src/resources/editor/tools/yaml/yaml-intelligence-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -6022,6 +6022,22 @@
}
}
},
{
"id": "brand-path-only-light-dark",
"anyOf": [
"string",
{
"object": {
"closed": true,
"properties": {
"light": "string",
"dark": "string"
}
}
}
],
"description": "A path to a brand.yml file, or an object with light and dark paths to brand.yml\n"
},
{
"id": "brand-path-bool-light-dark",
"anyOf": [
Expand Down Expand Up @@ -13424,9 +13440,9 @@
},
"brand": {
"schema": {
"ref": "brand-path-bool-light-dark"
"ref": "brand-path-only-light-dark"
},
"description": "Branding information to use for this document. If a string, the path to a brand file.\nIf false, don't use branding on this document. If an object, an inline brand\ndefinition, or an object with light and dark brand paths or definitions.\n"
"description": "Path to brand.yml or object with light and dark paths to brand.yml\n"
},
"preview": {
"description": "Options for `quarto preview`",
Expand Down Expand Up @@ -16967,6 +16983,7 @@
"HTML library (JS/CSS/etc.) directory",
"Additional file resources to be copied to output directory",
"Additional file resources to be copied to output directory",
"Branding information to use for this document. If a string, the path\nto a brand file. If false, don’t use branding on this document. If an\nobject, an inline brand definition, or an object with light and dark\nbrand paths or definitions.",
"Options for <code>quarto preview</code>",
"Scripts to run as a pre-render step",
"Scripts to run as a post-render step",
Expand Down Expand Up @@ -17316,6 +17333,7 @@
"HTML library (JS/CSS/etc.) directory",
"Additional file resources to be copied to output directory",
"Additional file resources to be copied to output directory",
"Branding information to use for this document. If a string, the path\nto a brand file. If false, don’t use branding on this document. If an\nobject, an inline brand definition, or an object with light and dark\nbrand paths or definitions.",
"Options for <code>quarto preview</code>",
"Scripts to run as a pre-render step",
"Scripts to run as a post-render step",
Expand Down Expand Up @@ -17650,7 +17668,8 @@
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“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’.",
"A path to a brand.yml file, or an object with light and dark paths to\nbrand.yml"
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -17879,12 +17898,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
"_internalId": 197505,
"_internalId": 197527,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
"_internalId": 197497,
"_internalId": 197519,
"type": "enum",
"enum": [
"png",
Expand All @@ -17900,7 +17919,7 @@
"exhaustiveCompletions": true
},
"theme": {
"_internalId": 197504,
"_internalId": 197526,
"type": "anyOf",
"anyOf": [
{
Expand Down
11 changes: 11 additions & 0 deletions src/resources/schema/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3343,6 +3343,17 @@
defaults:
ref: brand-defaults

- id: brand-path-only-light-dark
anyOf:
- string
- object:
closed: true
properties:
light: string
dark: string
description: |
A path to a brand.yml file, or an object with light and dark paths to brand.yml

- id: brand-path-bool-light-dark
anyOf:
- string # a file path
Expand Down
21 changes: 20 additions & 1 deletion src/resources/schema/json-schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -4077,6 +4077,25 @@
}
}
},
"BrandPathOnlyLightDark": {
"anyOf": [
{
"type": "string"
},
{
"object": {
"properties": {
"light": {
"type": "string"
},
"dark": {
"type": "string"
}
}
}
}
]
},
"BrandPathBoolLightDark": {
"anyOf": [
{
Expand Down Expand Up @@ -4180,7 +4199,7 @@
]
},
"brand": {
"$ref": "#/$defs/BrandPathBoolLightDark"
"$ref": "#/$defs/BrandPathOnlyLightDark"
},
"preview": {
"$ref": "#/$defs/ProjectPreview"
Expand Down
6 changes: 2 additions & 4 deletions src/resources/schema/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
description: "Additional file resources to be copied to output directory"
brand:
schema:
ref: brand-path-bool-light-dark
ref: brand-path-only-light-dark
description: |
Branding information to use for this document. If a string, the path to a brand file.
If false, don't use branding on this document. If an object, an inline brand
definition, or an object with light and dark brand paths or definitions.
Path to brand.yml or object with light and dark paths to brand.yml
preview:
description: Options for `quarto preview`
schema:
Expand Down
7 changes: 6 additions & 1 deletion src/resources/types/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,11 @@ export type BrandUnified = {
typography?: BrandTypographyUnified;
};

export type BrandPathOnlyLightDark = string | {
dark?: string;
light?: string;
}; /* A path to a brand.yml file, or an object with light and dark paths to brand.yml */

export type BrandPathBoolLightDark =
| string
| boolean
Expand Down Expand Up @@ -1588,7 +1593,7 @@ export type ProjectConfig = {
"lib-dir"?: string /* HTML library (JS/CSS/etc.) directory */;
"pre-render"?: MaybeArrayOf<string>;
"post-render"?: MaybeArrayOf<string>;
brand?: BrandPathBoolLightDark;
brand?: BrandPathOnlyLightDark;
detect?: ((string)[])[];
preview?: ProjectPreview;
render?: (string)[] /* Files to render (defaults to all files) */;
Expand Down
Loading
Loading