authorgravatar for chris@xenforo.comChris Deeming <chris@xenforo.com> 2026-10-02 00:58:29+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-01 16:58:29-07:00
log67f640093ffea1adaa585949d87e4bc2010b0810
treed3afc60d77bbde83c0550bc9129a5f0c2ff5fa67
parent10ac2f2ba495508a2a2fd469e67eda5df73f0df1
signature Signed by PGP key B5690EEEBB952194

fix(web): show the Docker icon on dockerfile code blocks (#14675)


2 files changed, 14 insertions(+), 2 deletions(-)

apps/web/src/pierre-icons.test.ts+5
......@@ -56,7 +56,12 @@ describe("Pierre file icons", () => {
5656
5757 it("normalizes common markdown fence language aliases", () => {
5858 assert.equal(syntheticFileNameForLanguageId("typescript"), "file.ts");
59 assert.equal(syntheticFileNameForLanguageId("dockerfile"), "Dockerfile");
5960 assert.equal(syntheticFileNameForLanguageId("shellscript"), "file.sh");
6061 assert.equal(syntheticFileNameForLanguageId("python"), "file.py");
6162 });
63
64 it("gives a dockerfile fence the Docker icon", () => {
65 assert.isTrue(hasSpecificPierreIconForFileName(syntheticFileNameForLanguageId("dockerfile")));
66 });
6267});
apps/web/src/pierre-icons.ts+9-2
......@@ -51,7 +51,6 @@ const completeIconResolver = createFileTreeIconResolver(T3_PIERRE_ICONS);
5151const LANGUAGE_EXTENSION_ALIASES: Record<string, string> = {
5252 bash: "sh",
5353 csharp: "cs",
54 dockerfile: "dockerfile",
5554 javascript: "js",
5655 jsx: "jsx",
5756 markdown: "md",
......@@ -79,9 +78,17 @@ export function inferEntryKindFromPath(pathValue: string): "file" | "directory"
7978 return base.includes(".") ? "file" : "directory";
8079}
8180
81/** Languages whose files are recognised by name rather than by extension. */
82const LANGUAGE_FILE_NAMES: Record<string, string> = {
83 dockerfile: "Dockerfile",
84};
85
8286export function syntheticFileNameForLanguageId(languageId: string): string {
8387 const normalized = languageId.toLowerCase();
84 return `file.${LANGUAGE_EXTENSION_ALIASES[normalized] ?? normalized}`;
88 return (
89 LANGUAGE_FILE_NAMES[normalized] ??
90 `file.${LANGUAGE_EXTENSION_ALIASES[normalized] ?? normalized}`
91 );
8592}
8693
8794export function resolvePierreIconForEntry(