Skip to content

Commit

Permalink
feat(front): add Dockerfile and YAML syntax-highlighter support
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Feb 11, 2024
1 parent 2b71307 commit 97315e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion back/src/components/posts/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"HTML",
"Shell",
"Svelte",
"plaintext"
"plaintext",
"YAML",
"Dockerfile"
],
"required": true,
"default": "plaintext"
Expand Down
4 changes: 4 additions & 0 deletions front/src/lib/components/posts/Code/Code.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import json from 'svelte-highlight/languages/json';
import plaintext from 'svelte-highlight/languages/plaintext';
import xml from 'svelte-highlight/languages/xml';
import yaml from 'svelte-highlight/languages/yaml';
import dockerfile from 'svelte-highlight/languages/dockerfile';
import CodeCopy from './CodeCopy.svelte';
import '@styles/components/Code/Code.css';
Expand All @@ -32,6 +34,8 @@
json,
hcl: javascript,
html: xml,
yaml: yaml,
dockerfile: dockerfile,
};
let language = which[langLower] || plaintext;
Expand Down
3 changes: 3 additions & 0 deletions front/src/lib/styles/components/Code/Code.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@
}
&.headerless,
&.titleless {
.syntax-highlighter__screen-wrap {
padding-bottom: 0.25rem;
}
> pre {
padding-top: 1rem;
}
Expand Down

0 comments on commit 97315e9

Please sign in to comment.