Skip to content

Commit 10b264c

Browse files
committed
Warn users if they attempt to use listings in a non-website
1 parent af267c5 commit 10b264c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/format/html/format-html.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77
import { join } from "path/mod.ts";
8+
import { warning } from "log/mod.ts";
89

910
import * as ld from "../../core/lodash.ts";
1011

@@ -98,6 +99,7 @@ import {
9899
notebookViewPostProcessor,
99100
} from "./format-html-notebook.ts";
100101
import { ProjectContext } from "../../project/types.ts";
102+
import { kListing } from "../../project/types/website/listing/website-listing-shared.ts";
101103

102104
export function htmlFormat(
103105
figwidth: number,
@@ -130,6 +132,13 @@ export function htmlFormat(
130132
offset: string,
131133
project: ProjectContext,
132134
) => {
135+
// Warn the user if they are using a listing outside of a website
136+
if (!project && format.metadata[kListing]) {
137+
warning(
138+
`Quarto only supports listings within websites. Please ensure that the file ${input} is a part of a website project to enable listing rendering.`,
139+
);
140+
}
141+
133142
const htmlFilterParams = htmlFormatFilterParams(format);
134143
return mergeConfigs(
135144
await htmlFormatExtras(input, flags, offset, format, services.temp),

0 commit comments

Comments
 (0)