Fix code style

This commit is contained in:
WinnerWind 2025-07-15 12:46:53 +05:30
parent 02b8c1db95
commit da13359e5a
2 changed files with 34 additions and 30 deletions

View File

@ -99,7 +99,7 @@ const REGEXP = /\[!!([^\]]+)\]/gm
const CODEREGEX = /`([^`\n]+)`/g const CODEREGEX = /`([^`\n]+)`/g
export interface Options { export interface Options {
customBadges: Array<[string, string, [number, number, number, number], number]>, // Write in format [ [icon,name,[RED,GREEN,BLUE,ALPHA],TEXT_ALPHA], [icon,name,[RED,GREEN,BLUE,ALPHA],TEXT_ALPHA] ] customBadges: Array<[string, string, [number, number, number, number], number]> // Write in format [ [icon,name,[RED,GREEN,BLUE,ALPHA],TEXT_ALPHA], [icon,name,[RED,GREEN,BLUE,ALPHA],TEXT_ALPHA] ]
useObsidianCSS: boolean useObsidianCSS: boolean
} }
@ -115,8 +115,8 @@ export const InlineBadges: QuartzTransformerPlugin<Partial<Options>> = (userOpts
name: "InlineBadges", name: "InlineBadges",
textTransform(_ctx, src) { textTransform(_ctx, src) {
// Append custom badges. // Append custom badges.
for (let badge of opts.customBadges){ for (let badge of opts.customBadges) {
allBadges.push([badge[1],badge[1],badge[0]]) // Pushes it to the array in the format [icon,icon,name]. allBadges.push([badge[1], badge[1], badge[0]]) // Pushes it to the array in the format [icon,icon,name].
} }
var srcReplacement: string = src //Start by assuming there are no badges. var srcReplacement: string = src //Start by assuming there are no badges.
@ -142,7 +142,7 @@ export const InlineBadges: QuartzTransformerPlugin<Partial<Options>> = (userOpts
inline: true, inline: true,
}) })
// Sets the colour of custom badges. // Sets the colour of custom badges.
for (let badgeDef of opts.customBadges){ for (let badgeDef of opts.customBadges) {
let badgeColor: string = `${badgeDef[2][0]},${badgeDef[2][1]},${badgeDef[2][2]}` let badgeColor: string = `${badgeDef[2][0]},${badgeDef[2][1]},${badgeDef[2][2]}`
let textColor: string = `rgba(var(--badge-color),${badgeDef[3]})` let textColor: string = `rgba(var(--badge-color),${badgeDef[3]})`
let badgeName: string = badgeDef[1] // Removes the "" from the name. let badgeName: string = badgeDef[1] // Removes the "" from the name.
@ -155,10 +155,10 @@ export const InlineBadges: QuartzTransformerPlugin<Partial<Options>> = (userOpts
inline: true, inline: true,
}) })
if (opts.useObsidianCSS){ if (opts.useObsidianCSS) {
css.push({ css.push({
content: obsidianOptionalCSS, content: obsidianOptionalCSS,
inline: true inline: true,
}) })
} }
} }

View File

@ -1,14 +1,14 @@
// This CSS is required to render badges properly. // This CSS is required to render badges properly.
// WinnerWind. // WinnerWind.
:root{ :root {
body{ body {
--radius-l: 12px; --radius-l: 12px;
--radius-m: 8px; --radius-m: 8px;
--radius-s: 4px; --radius-s: 4px;
a.external .external-icon { a.external .external-icon {
height:0px; height: 0px;
margin:0em; margin: 0em;
display:none; display: none;
} }
} }
} }
@ -58,9 +58,11 @@
--interactive-accent: var(--color-accent); --interactive-accent: var(--color-accent);
--interactive-accent-hover: var(--color-accent-1); --interactive-accent-hover: var(--color-accent-1);
--mono-rgb-100: 255, 255, 255; --mono-rgb-100: 255, 255, 255;
--shadow-l: 0px 1.8px 7.3px rgba(0, 0, 0, 0.071), 0px 6.3px 24.7px rgba(0, 0, 0, 0.112), --shadow-l:
0px 1.8px 7.3px rgba(0, 0, 0, 0.071), 0px 6.3px 24.7px rgba(0, 0, 0, 0.112),
0px 30px 90px rgba(0, 0, 0, 0.2); 0px 30px 90px rgba(0, 0, 0, 0.2);
--shadow-s: 0px 1px 2px rgba(0, 0, 0, 0.121), 0px 3.4px 6.7px rgba(0, 0, 0, 0.179), --shadow-s:
0px 1px 2px rgba(0, 0, 0, 0.121), 0px 3.4px 6.7px rgba(0, 0, 0, 0.179),
0px 15px 30px rgba(0, 0, 0, 0.3); 0px 15px 30px rgba(0, 0, 0, 0.3);
--text-accent: var(--color-accent-1); --text-accent: var(--color-accent-1);
color-scheme: dark; color-scheme: dark;
@ -114,9 +116,11 @@
--h5-color: var(--chalk-grey); --h5-color: var(--chalk-grey);
--h6-color: var(--chalk-grey); --h6-color: var(--chalk-grey);
--mono-rgb-100: 0, 0, 0; --mono-rgb-100: 0, 0, 0;
--shadow-l: 0px 1.8px 7.3px rgba(0, 0, 0, 0.071), 0px 6.3px 24.7px rgba(0, 0, 0, 0.112), --shadow-l:
0px 1.8px 7.3px rgba(0, 0, 0, 0.071), 0px 6.3px 24.7px rgba(0, 0, 0, 0.112),
0px 30px 90px rgba(0, 0, 0, 0.2); 0px 30px 90px rgba(0, 0, 0, 0.2);
--shadow-s: 0px 1px 2px rgba(0, 0, 0, 0.028), 0px 3.4px 6.7px rgba(0, 0, 0, 0.042), --shadow-s:
0px 1px 2px rgba(0, 0, 0, 0.028), 0px 3.4px 6.7px rgba(0, 0, 0, 0.042),
0px 15px 30px rgba(0, 0, 0, 0.07); 0px 15px 30px rgba(0, 0, 0, 0.07);
color-scheme: light; color-scheme: light;