Skip to content

Commit

Permalink
🚧 biome: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Dec 20, 2024
1 parent ad4ae5e commit e9835fc
Show file tree
Hide file tree
Showing 37 changed files with 2,248 additions and 2,232 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ indent_style = space
indent_size = 4
tab_width = 4

[*.yml]
[*.{yaml,yml}]
indent_size = 2

[*.md]
Expand Down
14 changes: 0 additions & 14 deletions .prettierrc

This file was deleted.

7 changes: 5 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
},
"files": {
"ignoreUnknown": false,
"ignore": []
"ignore": [
"*.scss",
"*.css"
]
},
"formatter": {
"enabled": true,
Expand All @@ -31,4 +34,4 @@
"quoteStyle": "double"
}
}
}
}
2 changes: 1 addition & 1 deletion esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import esbuild from "esbuild";
import process from "node:process";
import builtins from 'builtin-modules';
import { copy } from 'esbuild-plugin-copy';
import path, { basename } from 'node:path';
import { basename } from 'node:path';
import { sassPlugin } from 'esbuild-sass-plugin';
import { readdirSync } from "node:fs";
import { config } from "dotenv";
Expand Down
2 changes: 1 addition & 1 deletion src/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface SlidesExtendedSettings {
slideNumber: boolean;
showGrid: boolean;
autoComplete: string;
paneMode: 'split' | 'tab' | 'sidebar';
paneMode: "split" | "tab" | "sidebar";
themeDirectory: string;
center: boolean;
}
Expand Down
26 changes: 14 additions & 12 deletions src/obsidian/comment.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Properties } from './transformers';
import { Properties } from "./transformers";

export class Comment extends Properties {
type: string;

constructor(type: string, attributes: Map<string, string>) {
attributes.set('onTarget', type);
attributes.set("onTarget", type);
super(attributes);
this.type = type;
}
Expand All @@ -16,26 +16,28 @@ export class Comment extends Properties {
attributes: Map<string, string> = new Map<string, string>(),
): Comment {
if (clazz && clazz.length > 0) {
const classValue = attributes.get('class');
const classValue = attributes.get("class");

if (classValue) {
const split = classValue.split(' ');
const split = classValue.split(" ");
split.push(...clazz);
attributes.set('class', split.join(' '));
attributes.set("class", split.join(" "));
} else {
attributes.set('class', clazz.join(' '));
attributes.set("class", clazz.join(" "));
}
}

if (style && style.length > 0) {
const styleValue = attributes.get('style');
const styleValue = attributes.get("style");

if (styleValue) {
const split = styleValue.split(';').map(value => value.trim());
const split = styleValue
.split(";")
.map((value) => value.trim());
split.push(...style);
attributes.set('style', split.join('; '));
attributes.set("style", split.join("; "));
} else {
attributes.set('style', style.join('; '));
attributes.set("style", style.join("; "));
}
}

Expand All @@ -57,8 +59,8 @@ export class CommentParser {
const styles = comment.getStyles();
const classes = comment.getClasses();

const stylesString = styles.length > 0 ? `style="${styles}" ` : '';
const classesString = classes.length > 0 ? `class="${classes}" ` : '';
const stylesString = styles.length > 0 ? `style="${styles}" ` : "";
const classesString = classes.length > 0 ? `class="${classes}" ` : "";

return `${stylesString}${classesString}${comment.getAttributes()}`.trim();
}
Expand Down
4 changes: 2 additions & 2 deletions src/obsidian/embeddedSlideProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SlidesExtendedPlugin } from "../slidesExtended-Plugin";
import type { EmbeddedSlideParameters } from "../@types";
import { load } from "js-yaml";
import type { EmbeddedSlideParameters } from "../@types";
import type { SlidesExtendedPlugin } from "../slidesExtended-Plugin";

export class EmbeddedSlideProcessor {
private plugin: SlidesExtendedPlugin;
Expand Down
100 changes: 50 additions & 50 deletions src/obsidian/markdownProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { BlockProcessor } from './processors/blockProcessor';
import { ExcalidrawProcessor } from './processors/excalidrawProcessor';
import { FootnoteProcessor } from './processors/footNoteProcessor';
import { FormatProcessor } from './processors/formatProcessor';
import { FragmentProcessor } from './processors/fragmentProcessor';
import { GridProcessor } from './processors/gridProcessor';
import { MediaProcessor } from './processors/mediaProcessor';
import { InternalLinkProcessor } from './processors/internalLinkProcessor';
import { LatexProcessor } from './processors/latexProcessor';
import { MermaidProcessor } from './processors/mermaidProcessor';
import { MultipleFileProcessor } from './processors/multipleFileProcessor';
import type { ObsidianUtils } from "./obsidianUtils";
import { CommentProcessor } from './processors/commentProcessor';
import { DropProcessor } from './processors/dropProcessor';
import { YamlStore } from '../yaml/yamlStore';
import { AutoClosingProcessor } from './processors/autoClosingProcessor';
import { EmojiProcessor } from './processors/emojiProcessor';
import { IconsProcessor } from './processors/iconsProcessor';
import { DebugViewProcessor } from './processors/debugViewProcessor';
import { CalloutProcessor } from './processors/calloutProcessor';
import { TemplateProcessor } from './processors/templateProcessor';
import { ChartProcessor } from './processors/chartProcessor';
import { DefaultBackgroundProcessor } from './processors/defaultBackgroundProcessor';
import { ReferenceProcessor } from './processors/referenceProcessor';
import { SkipSlideProcessor } from './processors/skipSlideProcessor';
import type { Options } from "../@types";
import { YamlStore } from "../yaml/yamlStore";
import type { ObsidianUtils } from "./obsidianUtils";
import { AutoClosingProcessor } from "./processors/autoClosingProcessor";
import { BlockProcessor } from "./processors/blockProcessor";
import { CalloutProcessor } from "./processors/calloutProcessor";
import { ChartProcessor } from "./processors/chartProcessor";
import { CommentProcessor } from "./processors/commentProcessor";
import { DebugViewProcessor } from "./processors/debugViewProcessor";
import { DefaultBackgroundProcessor } from "./processors/defaultBackgroundProcessor";
import { DropProcessor } from "./processors/dropProcessor";
import { EmojiProcessor } from "./processors/emojiProcessor";
import { ExcalidrawProcessor } from "./processors/excalidrawProcessor";
import { FootnoteProcessor } from "./processors/footNoteProcessor";
import { FormatProcessor } from "./processors/formatProcessor";
import { FragmentProcessor } from "./processors/fragmentProcessor";
import { GridProcessor } from "./processors/gridProcessor";
import { IconsProcessor } from "./processors/iconsProcessor";
import { InternalLinkProcessor } from "./processors/internalLinkProcessor";
import { LatexProcessor } from "./processors/latexProcessor";
import { MediaProcessor } from "./processors/mediaProcessor";
import { MermaidProcessor } from "./processors/mermaidProcessor";
import { MultipleFileProcessor } from "./processors/multipleFileProcessor";
import { ReferenceProcessor } from "./processors/referenceProcessor";
import { SkipSlideProcessor } from "./processors/skipSlideProcessor";
import { TemplateProcessor } from "./processors/templateProcessor";

export class MarkdownProcessor {
private multipleFileProcessor: MultipleFileProcessor;
Expand Down Expand Up @@ -177,106 +177,106 @@ export class MarkdownProcessor {
);

if (options.log) {
this.log('markdown', '', markdown);
this.log('merge & template', markdown, after);
this.log('afterSkipSlideProcessor', after, afterSkipSlideProcessor);
this.log("markdown", "", markdown);
this.log("merge & template", markdown, after);
this.log("afterSkipSlideProcessor", after, afterSkipSlideProcessor);
this.log(
'afterReferenceProcessor',
"afterReferenceProcessor",
afterSkipSlideProcessor,
afterReferenceProcessor,
);
this.log(
'afterDebugViewProcessor',
"afterDebugViewProcessor",
afterReferenceProcessor,
afterDebugViewProcessor,
);
this.log(
'afterAutoClosingProcessor',
"afterAutoClosingProcessor",
afterDebugViewProcessor,
afterAutoClosingProcessor,
);
this.log(
'defaultBackgroundProcessor',
"defaultBackgroundProcessor",
afterAutoClosingProcessor,
defaultBackgroundProcessor,
);
this.log(
'afterCalloutProcessor',
"afterCalloutProcessor",
defaultBackgroundProcessor,
afterCalloutProcessor,
);
this.log(
'afterEmojiProcessor',
"afterEmojiProcessor",
afterCalloutProcessor,
afterEmojiProcessor,
);
this.log(
'afterIconsProcessor',
"afterIconsProcessor",
afterEmojiProcessor,
afterIconsProcessor,
);
this.log(
'afterMermaidProcessor',
"afterMermaidProcessor",
afterIconsProcessor,
afterMermaidProcessor,
);
this.log(
'afterBlockProcessor',
"afterBlockProcessor",
afterMermaidProcessor,
afterBlockProcessor,
);
this.log(
'afterFootNoteProcessor',
"afterFootNoteProcessor",
afterBlockProcessor,
afterFootNoteProcessor,
);
this.log(
'afterExcalidrawProcessor',
"afterExcalidrawProcessor",
afterFootNoteProcessor,
afterExcalidrawProcessor,
);
this.log(
'afterMediaProcessor',
"afterMediaProcessor",
afterExcalidrawProcessor,
afterMediaProcessor,
);
this.log(
'afterInternalLinkProcessor',
"afterInternalLinkProcessor",
afterMediaProcessor,
afterInternalLinkProcessor,
);
this.log(
'afterLatexProcessor',
"afterLatexProcessor",
afterInternalLinkProcessor,
afterLatexProcessor,
);
this.log(
'afterFormatProcessor',
"afterFormatProcessor",
afterLatexProcessor,
afterFormatProcessor,
);
this.log(
'afterFragmentProcessor',
"afterFragmentProcessor",
afterFormatProcessor,
afterFragmentProcessor,
);
this.log(
'afterDropProcessor',
"afterDropProcessor",
afterFragmentProcessor,
afterDropProcessor,
);
this.log(
'afterGridProcessor',
"afterGridProcessor",
afterDropProcessor,
afterGridProcessor,
);
this.log(
'afterCommentProcessor',
"afterCommentProcessor",
afterGridProcessor,
afterCommentProcessor,
);
this.log(
'afterChartProcessor',
"afterChartProcessor",
afterCommentProcessor,
afterChartProcessor,
);
Expand All @@ -286,11 +286,11 @@ export class MarkdownProcessor {
}

postProcess = (element: HTMLElement) => {
const paragraphs = element.querySelectorAll<HTMLParagraphElement>('p');
const paragraphs = element.querySelectorAll<HTMLParagraphElement>("p");
for (let index = 0; index < paragraphs.length; index++) {
const paragraph = paragraphs.item(index);

if (paragraph.innerText.startsWith(':::')) {
if (paragraph.innerText.startsWith(":::")) {
paragraph.remove();
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/obsidian/obsidianUtils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from "node:path";
import { readFileSync } from "fs-extra";
import {
type App,
FileSystemAdapter,
resolveSubpath,
type TFile,
resolveSubpath,
} from "obsidian";
import path from "node:path";
import type { SlidesExtendedSettings, MediaCollector } from "../@types";
import type { MediaCollector, SlidesExtendedSettings } from "../@types";
import { DISABLED_IMAGE_COLLECTOR } from "../slidesExtended-constants";
import { MarkdownProcessor } from "./markdownProcessor";

Expand Down Expand Up @@ -61,7 +61,9 @@ export class ObsidianUtils implements MediaCollector {
this.cssSearchPath = [
path.join(this.pluginDir), // relative to plugin dir
];
this.highlightSearchPath = [path.join(this.pluginDir, "plugin/highlight")];
this.highlightSearchPath = [
path.join(this.pluginDir, "plugin/highlight"),
];
this.themeSearchPath = [
path.join(this.pluginDir, "css"), // plugin layouts
path.join(this.distDir, "theme"), // reveal.js themes
Expand Down Expand Up @@ -341,7 +343,9 @@ export class ObsidianUtils implements MediaCollector {
}

resetImageCollection() {
console.debug("enable image collection for exported slides, start collecting");
console.debug(
"enable image collection for exported slides, start collecting",
);
this.images.clear();
this.isCollecting = true;
}
Expand Down
Loading

0 comments on commit e9835fc

Please sign in to comment.