Remove deprecated CSS files and enhance markdown processing service

- Deleted highlight-default.min.css, katex.min.css, and markdown.css as they are no longer needed.
- Implemented StreamingMarkdownService for improved markdown processing with support for math and syntax highlighting.
- Added StreamingService for handling streaming requests to the Gemini API with error handling and chunk parsing.
- Introduced styles_old.css for enhanced code block styling and better readability.
This commit is contained in:
Andrew Beal 2025-09-26 20:48:05 +01:00
parent 3f37870aaa
commit 7efdac24cf
25 changed files with 2221 additions and 1971 deletions

View file

@ -1,5 +1,4 @@
import { AIProviderURL } from "Enums/ApiProvider";
import { request, type RequestUrlParam } from "obsidian";
import { Resolve } from "Services/DependencyService";
import { Services } from "Services/Services";
import type { IActioner } from "Actioner/IActioner";
@ -7,62 +6,63 @@ import type { GeminiActionDefinitions } from "Actioner/Gemini/GeminiActionDefini
import { create_file } from "Actioner/Actions";
import type { IAIClass } from "AIClasses/IAIClass";
import type { IPrompt } from "AIClasses/IPrompt";
import type { GenerateContentResponse, Part } from "@google/genai";
import type { Part } from "@google/genai";
import { StreamingService, type StreamChunk } from "Services/StreamingService";
export class Gemini implements IAIClass {
private readonly apiKey: string;
private readonly aiPrompt: IPrompt;
private readonly actionDefinitions: GeminiActionDefinitions;
private readonly streamingService: StreamingService;
public constructor(apiKey: string) {
this.apiKey = apiKey;
this.aiPrompt = Resolve(Services.IPrompt);
this.actionDefinitions = Resolve(Services.IActionDefinitions);
this.streamingService = new StreamingService();
}
public async apiRequest(userInput: string, actioner: IActioner): Promise<Part[] | null> {
let prompt: string = "The users prompt is: " + userInput;
/**
* Stream response from Gemini API
*/
public async* streamRequest(
userInput: string,
actioner: IActioner
): AsyncGenerator<StreamChunk, void, unknown> {
const prompt = "The users prompt is: " + userInput;
let requestBody = JSON.stringify({
const requestBody = {
contents: [
{
role: "user",
parts: [
{
text: this.aiPrompt.instructions() + "\n" +
this.aiPrompt.responseFormat() + "\n" +
this.aiPrompt.getDirectories() + "\n" +
prompt + "\n" +
this.aiPrompt.instructionsReminder()
text:
this.aiPrompt.instructions() +
"\n" +
this.aiPrompt.responseFormat() +
"\n" +
this.aiPrompt.getDirectories() +
"\n" +
prompt +
"\n" +
this.aiPrompt.instructionsReminder(),
},
],
},
],
tools: [{
functionDeclarations: [this.actionDefinitions[create_file]]
}]
});
let reqParam: RequestUrlParam = {
url: AIProviderURL.Gemini,
method: "POST",
headers: {
"X-goog-api-key": this.apiKey,
"Content-Type": "application/json"
tools: [
{
functionDeclarations: [this.actionDefinitions[create_file]],
},
],
// Add streaming-specific parameters
generationConfig: {
temperature: 0.9,
//maxOutputTokens: 2048,
},
body: requestBody
};
let response: GenerateContentResponse = JSON.parse(await request(reqParam));
console.log(response);
let ai_response: Part[] = response.candidates?.first()?.content?.parts ?? [];
console.log(ai_response);
return ai_response;
yield* this.streamingService.streamGeminiRequest(this.apiKey, requestBody);
}
}

View file

@ -1,6 +1,6 @@
import type { Part } from "@google/genai";
import type { IActioner } from "Actioner/IActioner";
import type { StreamChunk } from "Services/StreamingService";
export interface IAIClass {
apiRequest(req: string, actioner: IActioner): Promise<Part[] | null>;
streamRequest(userInput: string, actioner: IActioner): AsyncGenerator<StreamChunk, void, unknown>;
}

View file

@ -24,9 +24,11 @@ export class AIPrompt implements IPrompt {
}
public readonly instructionsArr: string[] = [
/*
"You are an AI assistant for the Obsidian note taking app.",
"The user has provided extra context to your responsibilities:",
"You are a DND expert and can provide detailed information about DND rules, character creation, and gameplay mechanics. Please give concise responses."
"You are a DND expert and can provide detailed information about DND rules, character creation, and gameplay mechanics."
*/
];
public instructions(): string {
return this.instructionsArr.join("\n");

View file

@ -2,18 +2,13 @@
import { Resolve } from "Services/DependencyService";
import { MarkdownService } from "Services/MarkdownService";
import { Services } from "Services/Services";
import type { StreamingMarkdownService } from "Services/StreamingMarkdownService";
export let messages: Array<{id: string, content: string, isUser: boolean}> = [];
export let messages: Array<{id: string, content: string, isUser: boolean, isStreaming: boolean}> = [];
let chatContainer: HTMLDivElement;
let markdownService: MarkdownService;
// Initialize service once
try {
markdownService = Resolve(Services.MarkdownService);
} catch (error) {
console.error('Failed to initialize MarkdownService:', error);
}
let streamingMarkdownService: StreamingMarkdownService = Resolve(Services.StreamingMarkdownService);
// Process each message content with markdown
$: processedMessages = messages.map((message) => {
@ -25,7 +20,7 @@
} else {
let htmlContent;
try {
htmlContent = markdownService?.formatToHTML(message.content) || `<p>${message.content}</p>`;
htmlContent = streamingMarkdownService.formatText(message.content) || `<p>${message.content}</p>`;
} catch (err) {
console.error('HTML processing failed:', err);
htmlContent = `<p>${message.content}</p>`;
@ -45,9 +40,12 @@
{#if message.isUser}
<p>{message.content}</p>
{:else}
<div class="markdown-content">
{@html message.htmlContent}
</div>
<div class="markdown-content" class:streaming={message.isStreaming}>
{@html message.htmlContent}
{#if message.isStreaming}
<span class="streaming-indicator">● ● ●</span>
{/if}
</div>
{/if}
</div>
</div>
@ -60,7 +58,6 @@
{/if}
</div>
<!-- Keep your existing styles -->
<style>
.chat-area {
display: flex;
@ -107,93 +104,16 @@
color: var(--text-muted);
pointer-events: none;
}
.markdown-content {
line-height: 1.6;
}
/* Keep all your existing markdown styles */
.markdown-content :global(h1),
.markdown-content :global(h2),
.markdown-content :global(h3),
.markdown-content :global(h4),
.markdown-content :global(h5),
.markdown-content :global(h6) {
margin: 1rem 0 0.5rem 0;
color: var(--text-normal);
}
.markdown-content :global(h1) { font-size: 1.5em; }
.markdown-content :global(h2) { font-size: 1.3em; }
.markdown-content :global(h3) { font-size: 1.1em; }
.markdown-content :global(p) {
margin: 0.5rem 0;
}
.markdown-content :global(pre) {
background-color: var(--background-modifier-border);
padding: 1rem;
border-radius: var(--radius-s);
overflow-x: auto;
margin: 0.5rem 0;
}
.markdown-content :global(code) {
background-color: var(--background-modifier-border);
padding: 2px 4px;
border-radius: var(--radius-s);
font-family: var(--font-monospace, 'Courier New', monospace);
font-size: 0.9em;
}
.markdown-content :global(pre code) {
background-color: transparent;
padding: 0;
}
.markdown-content :global(blockquote) {
border-left: 4px solid var(--background-modifier-border);
margin: 1rem 0;
padding-left: 1rem;
color: var(--text-muted);
}
.markdown-content :global(ul),
.markdown-content :global(ol) {
padding-left: 1.5rem;
margin: 0.5rem 0;
}
.markdown-content :global(li) {
margin: 0.25rem 0;
}
.markdown-content :global(table) {
border-collapse: collapse;
width: 100%;
margin: 1rem 0;
border: 1px solid var(--background-modifier-border);
}
.markdown-content :global(th),
.markdown-content :global(td) {
border: 1px solid var(--background-modifier-border);
padding: 8px 12px;
text-align: left;
}
.markdown-content :global(th) {
background-color: var(--background-modifier-border);
font-weight: bold;
}
.markdown-content :global(a) {
.streaming-indicator {
display: inline-block;
color: var(--text-accent);
text-decoration: none;
animation: pulse 1.5s infinite;
margin-left: 4px;
}
.markdown-content :global(a:hover) {
text-decoration: underline;
@keyframes pulse {
0%, 100% { opacity: 0.3; }
50% { opacity: 1; }
}
</style>

View file

@ -1,13 +1,12 @@
<script lang="ts">
import type { Part } from "@google/genai";
import type { IActioner } from "Actioner/IActioner";
import type { IAIClass } from "AIClasses/IAIClass";
import { Semaphore } from "Helpers";
import { Resolve } from "Services/DependencyService";
import { Services } from "Services/Services";
import type { IActioner } from "Actioner/IActioner";
import { Semaphore } from "Helpers";
import { Resolve } from "Services/DependencyService";
import { Services } from "Services/Services";
import ChatArea from "./ChatArea.svelte";
import type { IAIClassStreaming } from "AIClasses/Gemini/Gemini";
let ai: IAIClass = Resolve(Services.IAIClass);
let ai: IAIClassStreaming = Resolve(Services.IAIClass);
let actioner: IActioner = Resolve(Services.IActioner);
let semaphore: Semaphore = new Semaphore(1, false);
@ -15,7 +14,12 @@
let userRequest = "";
let isSubmitting = false;
let messages: Array<{id: string, content: string, isUser: boolean}> = [];
let messages: Array<{
id: string,
content: string,
isUser: boolean,
isStreaming: boolean
}> = [];
async function handleSubmit() {
if (userRequest.trim() === "" || isSubmitting) {
@ -28,32 +32,62 @@
textareaElement.value = "";
autoResize();
if (!await semaphore.wait()) {
return;
}
// Add user message to chat
const userMessageId = `user-${Date.now()}`;
messages = [...messages, {
id: userMessageId,
content: requestToSend,
isUser: true
isUser: true,
isStreaming: true
}];
if (!await semaphore.wait()) {
return;
}
try {
let response: Part[] | null = await ai.apiRequest(requestToSend, actioner);
console.log(response);
// Add AI response to chat
if (response && response.length > 0) {
const aiMessageId = `ai-${Date.now()}`;
// Create AI message placeholder
const aiMessageId = `ai-${Date.now()}`;
messages = [...messages, {
id: aiMessageId,
content: "",
isUser: false,
isStreaming: true
}];
const responseText = response.map(part => part.text || '').join(' ');
messages = [...messages, {
id: aiMessageId,
content: responseText,
isUser: false
}];
// Stream the response
let accumulatedContent = "";
for await (const chunk of ai.streamRequest(requestToSend, actioner)) {
if (chunk.error) {
console.error("Streaming error:", chunk.error);
// Update message with error
messages = messages.map(msg =>
msg.id === aiMessageId
? { ...msg, content: "Error: " + chunk.error, isStreaming: false }
: msg
);
break;
}
if (chunk.content) {
accumulatedContent += chunk.content;
// Update the message with accumulated content
messages = messages.map(msg =>
msg.id === aiMessageId
? { ...msg, content: accumulatedContent }
: msg
);
}
if (chunk.isComplete) {
// Mark streaming as complete
messages = messages.map(msg =>
msg.id === aiMessageId
? { ...msg, content: accumulatedContent, isStreaming: false }
: msg
);
}
}
} finally {
semaphore.release();
@ -155,6 +189,5 @@
#submit:hover {
background-color: var(--interactive-accent-hover);
}
</style>

View file

@ -4,5 +4,5 @@ export enum AIProvider {
};
export enum AIProviderURL {
Gemini = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent"
Gemini = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?key=API_KEY&alt=sse"
}

View file

@ -25,6 +25,18 @@ export async function createDirectories(vault: Vault, filePath: string) {
}
}
export function loadExternalCSS(href: string): Promise<void> {
return new Promise((resolve, reject) => {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = href;
link.onload = () => resolve();
link.onerror = reject;
document.head.appendChild(link);
});
}
export class Semaphore {
private max: number;
private count: number;

View file

@ -50,58 +50,58 @@ export class MarkdownService {
private preprocessContent(content: string): string {
return content
// 1. LaTeX Math Notation (normalize different formats)
.replace(/\\\[([\s\S]*?)\\\]/g, (_, equation) => `$$${equation}$$`) // block math
.replace(/\\\(([\s\S]*?)\\\)/g, (_, equation) => `$${equation}$`) // inline math
// 2. Handle Code Block Language Tags (normalize variations)
.replace(/```(\w+)\s*\n/g, '```$1\n')
// 3. Fix Common Escape Issues (AI models sometimes over-escape)
// 1. LaTeX Math Notation (normalize different formats) - No change needed
.replace(/\\\[([\s\S]*?)\\\]/g, (_, equation) => `$$${equation}$$`)
.replace(/\\\(([\s\S]*?)\\\)/g, (_, equation) => `$${equation}$`)
// 2. Handle Code Block Language Tags (allow hyphens)
.replace(/```([a-zA-Z0-9-]+)\s*\n/g, '```$1\n')
// 3. Fix Common Escape Issues (use with caution) - No change, but be aware of its behavior
.replace(/\\`/g, '`')
.replace(/\\\*/g, '*')
.replace(/\\_/g, '_')
// 4. Normalize Line Endings
// 4. Normalize Line Endings - No change needed
.replace(/\r\n/g, '\n')
.replace(/\r/g, '\n')
// 5. Handle Triple Quotes (some models use these for code)
// 5. Handle Triple Quotes - No change needed
.replace(/"""\s*(\w+)?\s*\n([\s\S]*?)\n"""/g, (match, lang, code) => {
return lang ? `\`\`\`${lang}\n${code}\n\`\`\`` : `\`\`\`\n${code}\n\`\`\``;
})
// 6. Clean up Multiple Consecutive Newlines
.replace(/\n{4,}/g, '\n\n\n')
// 7. Handle Gemini's math-in-code-blocks tendency
// 6. Clean up Multiple Consecutive Newlines (collapse to a standard paragraph break)
.replace(/\n{3,}/g, '\n\n')
// 7. Handle Gemini's math-in-code-blocks tendency - No change needed
.replace(/```math\n([\s\S]*?)\n```/g, (_, equation) => {
if (equation.includes('\\') || equation.includes('{') || equation.includes('^') || equation.includes('_')) {
return `$$${equation}$$`;
}
return `\`\`\`\n${equation}\n\`\`\``;
})
// 8. Fix Bold/Italic Formatting Issues
.replace(/\*\*\s+([^*]+)\s+\*\*/g, '**$1**') // Remove extra spaces in bold
.replace(/\*\s+([^*]+)\s+\*/g, '*$1*') // Remove extra spaces in italic
// 9. Fix Table Formatting Issues
.replace(/^\|\s+/gm, '| ') // Clean up table cell spacing
.replace(/\s+\|$/gm, ' |') // Clean up table cell spacing
// 10. Handle Alternative List Markers
.replace(/^•\s/gm, '- ') // Convert bullet points to markdown
.replace(/^→\s/gm, '- ') // Convert arrows to markdown
// 11. Fix Link Formatting Issues
.replace(/\[\s+([^\]]+)\s+\]/g, '[$1]') // Remove spaces in link text
// 12. Handle Footnote Variations
.replace(/\[\^(\w+)\]:/g, '[^$1]:') // Normalize footnote definitions
// 13. Clean up Heading Formatting
.replace(/^#+\s+/gm, (match) => match.replace(/\s+/g, ' ')); // Single space after #
// 8. Fix Bold/Italic Formatting Issues - No change needed
.replace(/\*\*\s+([^*]+)\s+\*\*/g, '**$1**')
.replace(/\*\s+([^*]+)\s+\*/g, '*$1*')
// 9. Fix Table Formatting Issues - No change needed
.replace(/^\|\s+/gm, '| ')
.replace(/\s+\|$/gm, ' |')
// 10. Handle Alternative List Markers - No change needed
.replace(/^•\s/gm, '- ')
.replace(/^→\s/gm, '- ')
// 11. Fix Link Formatting Issues - No change needed
.replace(/\[\s+([^\]]+)\s+\]/g, '[$1]')
// 12. Handle Footnote Variations (remove optional spaces)
.replace(/\[\^(\w+)\]\s*:/g, '[^$1]:')
// 13. Clean up Heading Formatting - No change needed
.replace(/^#+\s+/gm, (match) => match.replace(/\s+/g, ' '));
}
private escapeHtml(text: string): string {

View file

@ -10,8 +10,9 @@ import type { IActioner } from "Actioner/IActioner";
import type { IAIClass } from "AIClasses/IAIClass";
import { GeminiActionDefinitions } from "Actioner/Gemini/GeminiActionDefinitions";
import type { IActionDefinitions } from "Actioner/IActionDefinitions";
import { Gemini } from "AIClasses/Gemini/Gemini";
import { Gemini, type IAIClassStreaming } from "AIClasses/Gemini/Gemini";
import { MarkdownService } from "./MarkdownService";
import { StreamingMarkdownService } from "./StreamingMarkdownService";
export function RegisterDependencies(plugin: DmsAssistantPlugin) {
RegisterSingleton(Services.DmsAssistantPlugin, plugin);
@ -22,6 +23,9 @@ export function RegisterDependencies(plugin: DmsAssistantPlugin) {
RegisterSingleton<IActioner>(Services.IActioner, new Actioner());
RegisterTransient<MarkdownService>(Services.MarkdownService, () => new MarkdownService());
RegisterTransient<StreamingMarkdownService>(Services.StreamingMarkdownService, () => new StreamingMarkdownService());
RegisterAiProvider(plugin);
}

View file

@ -2,7 +2,10 @@ export class Services {
static DmsAssistantPlugin = Symbol("DmsAssistantPlugin");
static OdbCache = Symbol("OdbCache");
static ModalService = Symbol("ModalService");
static StreamingService = Symbol("StreamingService");
static MarkdownService = Symbol("MarkdownService");
static StreamingMarkdownService = Symbol("StreamingMarkdownService");
// interfaces
static IAIClass = Symbol("IAIClass");

View file

@ -0,0 +1,79 @@
import { unified, type Processor } from 'unified';
import remarkParse from 'remark-parse';
import remarkMath from 'remark-math';
import remarkGfm from 'remark-gfm';
import remarkToc from 'remark-toc';
import remarkEmoji from 'remark-emoji';
import remarkRehype from 'remark-rehype';
import rehypeKatex from 'rehype-katex';
import rehypeHighlight from 'rehype-highlight';
import rehypeStringify from 'rehype-stringify';
import remarkBreaks from 'remark-breaks';
export class StreamingMarkdownService {
private static processor: Processor<any, any, any, any, any> | null = null;
constructor() {
if (!StreamingMarkdownService.processor) {
StreamingMarkdownService.processor = this.createProcessor();
}
}
private createProcessor() {
return unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkBreaks) // Note: This makes single newlines into <br> tags.
.use(remarkToc)
.use(remarkEmoji)
.use(remarkMath)
.use(remarkRehype, { allowDangerousHtml: false }) // Important for security
.use(rehypeKatex)
.use(rehypeHighlight)
.use(rehypeStringify);
}
public formatText(text: string) {
try {
const preprocessed = this.preprocessContent(text);
const result = StreamingMarkdownService.processor!.processSync(preprocessed);
return String(result);
} catch (error) {
console.warn('Markdown processing failed, falling back to safe rendering:', error);
// Fallback to basic HTML escaping if parsing fails
return text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\n/g, '<br>')
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
.replace(/\*(.+?)\*/g, '<em>$1</em>');
}
}
private preprocessContent(content: string): string {
return content
// Normalize line endings
.replace(/\r\n/g, '\n')
.replace(/\r/g, '\n')
// Fix LaTeX math delimiters
.replace(/\\\[([\s\S]*?)\\\]/g, '$$\n$1\n$$') // Block math
.replace(/\\\(([\s\S]*?)\\\)/g, '$$1$') // Inline math - CRITICAL FIX HERE
// Clean up excessive newlines to a standard paragraph break
.replace(/\n{3,}/g, '\n\n')
// Fix escaped characters that shouldn't be (use with caution)
.replace(/\\\*/g, '*')
.replace(/\\_/g, '_')
.replace(/\\`/g, '`')
// Ensure headers have a blank line above them for proper parsing
.replace(/(?<!\n)\n(#{1,6}\s)/g, '\n\n$1')
// Clean up extra spaces inside formatting (robust version)
.replace(/\*\*\s+([^*]+?)\s+\*\*/g, '**$1**')
.replace(/(?<!\*)\*\s+([^*]+?)\s+\*(?!\*)/g, '*$1*');
}
}

View file

@ -0,0 +1,105 @@
import { AIProviderURL } from "Enums/ApiProvider";
export interface StreamChunk {
content: string;
isComplete: boolean;
error?: string;
}
export class StreamingService {
/**
* Fetches data from Gemini API with streaming support
* Since Obsidian's request() doesn't support streaming, we use native fetch
*/
public async* streamGeminiRequest(
apiKey: string,
requestBody: unknown
): AsyncGenerator<StreamChunk, void, unknown> {
try {
const response = await fetch(
AIProviderURL.Gemini.replace("API_KEY", apiKey),
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(requestBody),
}
);
if (!response.ok) {
const errorText = await response.text();
throw new Error(`API request failed: ${response.status} - ${errorText}`);
}
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Response body is not readable");
}
const decoder = new TextDecoder();
let buffer = "";
let lastChunkWasComplete = false;
while (true) {
const { done, value } = await reader.read();
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop() || ""; // Keep potentially incomplete line in buffer
for (const line of lines) {
if (line.trim().startsWith("data:")) {
const jsonStr = line.trim().substring(5);
const chunk = this.parseStreamChunk(jsonStr);
lastChunkWasComplete = chunk.isComplete;
yield chunk;
}
}
if (done) {
break;
}
}
if (!lastChunkWasComplete) {
yield { content: "", isComplete: true };
}
} catch (error) {
console.error("Stream request error:", error);
yield {
content: "",
isComplete: true,
error: error instanceof Error ? error.message : "Unknown error",
};
}
}
private parseStreamChunk(chunk: string): StreamChunk {
try {
const data = JSON.parse(chunk);
let text = "";
const candidate = data.candidates?.[0];
if (candidate) {
if (candidate.content?.parts?.[0]?.text) {
text = candidate.content.parts[0].text;
} else if (candidate.text) {
text = candidate.text;
}
}
const isComplete = !!candidate?.finishReason;
return {
content: text,
isComplete: isComplete,
};
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown parsing error";
console.error("Failed to parse stream chunk:", message, "Chunk:", chunk);
return { content: "", isComplete: false, error: `Failed to parse chunk: ${message}` };
}
}
}

View file

@ -1,9 +0,0 @@
/*!
Theme: Default
Description: Original highlight.js style
Author: (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
Maintainer: @highlightjs/core-team
Website: https://highlightjs.org/
License: see project LICENSE
Touched: 2021
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#f3f3f3;color:#444}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}

373
Styles/katex.min.css vendored
View file

@ -1,373 +0,0 @@
/* KaTeX CSS with CDN font URLs */
@font-face {
font-family: 'KaTeX_AMS';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_AMS-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_AMS-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Caligraphic';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Caligraphic';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Fraktur';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Fraktur';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Main';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Main';
font-style: italic;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Italic.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Italic.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Main';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Math';
font-style: italic;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Math-Italic.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Math-Italic.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_SansSerif';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_SansSerif';
font-style: italic;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Italic.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Italic.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_SansSerif';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Script';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Script-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Script-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size1';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size1-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size1-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size2';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size2-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size2-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size3';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size3-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size3-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size4';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size4-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size4-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Typewriter';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Typewriter-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Typewriter-Regular.woff') format('woff');
}
/* Rest of KaTeX CSS styles */
.katex {
font: normal 1.21em KaTeX_Main, Times, serif;
line-height: 1.2;
white-space: nowrap;
text-indent: 0;
text-rendering: auto;
}
.katex * {
border-color: currentColor;
}
.katex .katex-version::after {
content: "0.16.0";
}
.katex .katex-mathml {
position: absolute;
visibility: hidden;
height: 1px;
overflow: hidden;
}
.katex .katex-html > .newline {
display: block;
}
.katex .base {
position: relative;
white-space: nowrap;
width: min-content;
}
.katex .strut {
display: inline-block;
}
.katex .textbf {
font-weight: bold;
}
.katex .textit {
font-style: italic;
}
.katex .textrm {
font-family: KaTeX_Main;
}
.katex .textsf {
font-family: KaTeX_SansSerif;
}
.katex .texttt {
font-family: KaTeX_Typewriter;
}
.katex .mathnormal {
font-family: KaTeX_Math;
font-style: italic;
}
.katex .mathit {
font-family: KaTeX_Main;
font-style: italic;
}
.katex .mathrm {
font-style: normal;
}
.katex .mathbf {
font-family: KaTeX_Main;
font-weight: bold;
}
.katex .boldsymbol {
font-family: KaTeX_Math;
font-weight: bold;
font-style: italic;
}
.katex .amsrm {
font-family: KaTeX_AMS;
}
.katex .mathbb,
.katex .textbb {
font-family: KaTeX_AMS;
}
.katex .mathcal {
font-family: KaTeX_Caligraphic;
}
.katex .mathfrak,
.katex .textfrak {
font-family: KaTeX_Fraktur;
}
.katex .mathtt {
font-family: KaTeX_Typewriter;
}
.katex .mathscr,
.katex .textscr {
font-family: KaTeX_Script;
}
.katex .mathsf,
.katex .textsf {
font-family: KaTeX_SansSerif;
}
.katex .mathboldsf,
.katex .textboldsf {
font-family: KaTeX_SansSerif;
font-weight: bold;
}
.katex .mathitsf,
.katex .textitsf {
font-family: KaTeX_SansSerif;
font-style: italic;
}
.katex .mainrm {
font-family: KaTeX_Main;
font-style: normal;
}
.katex .vlist-t {
display: inline-table;
table-layout: fixed;
border-collapse: collapse;
}
.katex .vlist-r {
display: table-row;
}
.katex .vlist {
display: table-cell;
vertical-align: bottom;
position: relative;
}
.katex .vlist > span {
display: block;
height: 0;
position: relative;
}
.katex .vlist > span > span {
display: inline-block;
}
.katex .vlist > span > .pstrut {
overflow: hidden;
width: 0;
}
.katex .hlist {
display: inline-flex;
flex-direction: row;
}
.katex .hlist > span {
flex: 0 0 auto;
}
.katex .vcenter {
display: inline-block;
vertical-align: middle;
}
.katex .alignleft {
text-align: left;
}
.katex .aligncenter {
text-align: center;
}
.katex .alignright {
text-align: right;
}
.katex .gothfrak,
.katex .textgothfrak {
font-family: KaTeX_Fraktur;
}
.katex .cmr {
font-family: KaTeX_Main;
}
.katex .cmss {
font-family: KaTeX_SansSerif;
}
.katex .cmtt {
font-family: KaTeX_Typewriter;
}
.katex .katex-display {
display: block;
margin: 1em 0;
text-align: center;
}
.katex .katex-display > .katex {
display: block;
white-space: nowrap;
max-width: 100%;
overflow-x: auto;
text-align: initial;
}
.katex .katex-display.leqno > .katex {
text-align: left;
}
.katex .katex-display.fleqn > .katex {
text-align: left;
padding-left: 2em;
}

View file

@ -1,153 +0,0 @@
/* Import the downloaded CSS files */
@import './katex.min.css';
@import './highlight-default.min.css';
/* Additional markdown styling for Obsidian plugin */
.markdown-processor-content {
line-height: 1.6;
color: var(--text-normal);
}
.markdown-processor-content h1,
.markdown-processor-content h2,
.markdown-processor-content h3,
.markdown-processor-content h4,
.markdown-processor-content h5,
.markdown-processor-content h6 {
margin: 1rem 0 0.5rem 0;
color: var(--text-normal);
font-weight: var(--font-weight-bold);
}
.markdown-processor-content h1 { font-size: 1.5em; }
.markdown-processor-content h2 { font-size: 1.3em; }
.markdown-processor-content h3 { font-size: 1.1em; }
.markdown-processor-content p {
margin: 0.5rem 0;
}
.markdown-processor-content pre {
background-color: var(--background-primary-alt);
padding: 1rem;
border-radius: var(--radius-s);
overflow-x: auto;
margin: 0.5rem 0;
border: 1px solid var(--background-modifier-border);
}
.markdown-processor-content code {
background-color: var(--background-primary-alt);
padding: 2px 4px;
border-radius: var(--radius-s);
font-family: var(--font-monospace);
font-size: 0.9em;
}
.markdown-processor-content pre code {
background-color: transparent;
padding: 0;
}
.markdown-processor-content blockquote {
border-left: 4px solid var(--background-modifier-border);
margin: 1rem 0;
padding-left: 1rem;
color: var(--text-muted);
font-style: italic;
}
.markdown-processor-content ul,
.markdown-processor-content ol {
padding-left: 1.5rem;
margin: 0.5rem 0;
}
.markdown-processor-content li {
margin: 0.25rem 0;
}
.markdown-processor-content table {
border-collapse: collapse;
width: 100%;
margin: 1rem 0;
border: 1px solid var(--background-modifier-border);
}
.markdown-processor-content th,
.markdown-processor-content td {
border: 1px solid var(--background-modifier-border);
padding: 8px 12px;
text-align: left;
}
.markdown-processor-content th {
background-color: var(--background-primary-alt);
font-weight: var(--font-weight-bold);
}
.markdown-processor-content a {
color: var(--text-accent);
text-decoration: none;
}
.markdown-processor-content a:hover {
text-decoration: underline;
}
/* Math content styling adjustments for Obsidian */
.markdown-processor-content .katex {
font-size: 1.1em;
}
.markdown-processor-content .katex-display {
margin: 1rem 0;
text-align: center;
}
/* Task list styling */
.markdown-processor-content input[type="checkbox"] {
margin-right: 0.5rem;
}
/* Footnotes styling */
.markdown-processor-content .footnotes {
margin-top: 2rem;
padding-top: 1rem;
border-top: 1px solid var(--background-modifier-border);
font-size: 0.9em;
}
/* Override highlight.js colors to use Obsidian theme colors */
.markdown-processor-content .hljs {
background: var(--background-primary-alt) !important;
color: var(--text-normal) !important;
}
.markdown-processor-content .hljs-comment,
.markdown-processor-content .hljs-quote {
color: var(--text-muted) !important;
}
.markdown-processor-content .hljs-keyword,
.markdown-processor-content .hljs-selector-tag,
.markdown-processor-content .hljs-literal {
color: var(--text-accent) !important;
}
.markdown-processor-content .hljs-string,
.markdown-processor-content .hljs-doctag {
color: var(--color-green) !important;
}
.markdown-processor-content .hljs-title,
.markdown-processor-content .hljs-section,
.markdown-processor-content .hljs-type {
color: var(--color-blue) !important;
}
.markdown-processor-content .hljs-number,
.markdown-processor-content .hljs-variable,
.markdown-processor-content .hljs-template-variable {
color: var(--color-purple) !important;
}

View file

@ -2,7 +2,7 @@ import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import { copyFileSync, mkdirSync, existsSync, readdirSync, statSync } from "fs";
import { join } from "path";
import path, { join } from "path";
import esbuildSvelte from 'esbuild-svelte';
import { sveltePreprocess } from 'svelte-preprocess';
@ -37,7 +37,7 @@ function copyDir(src, dest) {
}
}
const context = await esbuild.context({
const buildOptions = {
plugins: [
esbuildSvelte({
compilerOptions: { css: 'injected' },
@ -71,28 +71,13 @@ const context = await esbuild.context({
treeShaking: true,
outfile: "main.js",
minify: prod,
});
};
if (prod) {
await context.rebuild();
// Copy styles after production build
if (existsSync("Styles")) {
copyDir("Styles", "styles");
console.log("✅ Copied Styles directory to styles/");
} else {
console.log("⚠️ Styles directory not found, skipping copy");
}
process.exit(0);
await esbuild.build(buildOptions);
console.log("✅ Production build complete!");
} else {
// Copy styles for development
if (existsSync("Styles")) {
copyDir("Styles", "styles");
console.log("✅ Copied Styles directory to styles/");
} else {
console.log("⚠️ Styles directory not found, skipping copy");
}
await context.watch();
const ctx = await esbuild.context(buildOptions);
await ctx.watch();
console.log("👀 Watching for changes...");
}

510
main.css

File diff suppressed because one or more lines are too long

View file

@ -8,8 +8,7 @@ import { OdbCache } from 'ODB/Core/OdbCache';
import { FileAction } from 'Enums/FileAction';
import { Path } from 'Enums/Path';
import { RegisterAiProvider, RegisterDependencies } from 'Services/ServiceRegistration';
import './styles/markdown.css';
import { loadExternalCSS } from 'Helpers';
interface DmsAssistantSettings {
apiProvider: string;
@ -25,6 +24,11 @@ export default class DmsAssistantPlugin extends Plugin {
settings: DmsAssistantSettings;
async onload() {
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.js';
script.async = true;
document.head.appendChild(script);
await this.loadSettings();
RegisterDependencies(this);

919
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -29,17 +29,27 @@
},
"dependencies": {
"@google/genai": "^1.17.0",
"@shikijs/rehype": "^3.12.2",
"core-js": "^3.45.1",
"express": "^5.1.0",
"highlight.js": "^11.11.1",
"rehype-highlight": "^7.0.2",
"rehype-katex": "^7.0.1",
"rehype-parse": "^9.0.1",
"rehype-sanitize": "^6.0.0",
"rehype-stringify": "^10.0.1",
"remark-breaks": "^4.0.0",
"remark-definition-list": "^2.0.0",
"remark-emoji": "^5.0.2",
"remark-footnotes": "^4.0.1",
"remark-frontmatter": "^5.0.0",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.1.2",
"remark-relative-links": "^0.0.6",
"remark-toc": "^9.0.0",
"svelte-exmarkdown": "^5.0.2",
"unified": "^11.0.5",
"uuid": "^11.1.0"
}

View file

@ -1,8 +1,901 @@
/*
/* ============================== */
/* Syntax Highlighting Styles */
/* GitHub Dark Theme for highlight.js */
/* ============================== */
This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #e1e4e8;
background: #24292e;
}
If your plugin does not need CSS, delete this file.
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
color: #f97583;
}
*/
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
color: #b392f0;
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id,
.hljs-variable {
color: #79b8ff;
}
.hljs-meta .hljs-string,
.hljs-regexp,
.hljs-string {
color: #9ecbff;
}
.hljs-built_in,
.hljs-symbol {
color: #ffab70;
}
.hljs-code,
.hljs-comment,
.hljs-formula {
color: #6a737d;
}
.hljs-name,
.hljs-quote,
.hljs-selector-pseudo,
.hljs-selector-tag {
color: #85e89d;
}
.hljs-subst {
color: #e1e4e8;
}
.hljs-section {
color: #79b8ff;
font-weight: bold;
}
.hljs-bullet {
color: #ffab70;
}
.hljs-emphasis {
color: #e1e4e8;
font-style: italic;
}
.hljs-strong {
color: #e1e4e8;
font-weight: bold;
}
.hljs-addition {
color: #85e89d;
background-color: #144620;
}
.hljs-deletion {
color: #ffdcd7;
background-color: #86181d;
}
.hljs-char.escape_,
.hljs-link,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
color: #e1e4e8;
}
/* Alternative dark theme colors if preferred */
.hljs.github-dark-dimmed {
color: #adbac7;
background: #22272e;
}
/* ============================== */
/* KaTeX Math Rendering Styles */
/* ============================== */
.katex {
font: normal 1.21em KaTeX_Main, "Times New Roman", serif;
line-height: 1.2;
text-indent: 0;
text-rendering: auto;
}
.katex * {
-ms-high-contrast-adjust: none !important;
border-color: currentColor;
}
.katex .katex-mathml {
clip: rect(1px, 1px, 1px, 1px);
border: 0;
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.katex .katex-html > .newline {
display: block;
}
.katex .base {
position: relative;
white-space: nowrap;
width: -webkit-min-content;
width: -moz-min-content;
width: min-content;
}
.katex .base,
.katex .strut {
display: inline-block;
}
.katex .textbf {
font-weight: 700;
}
.katex .textit {
font-style: italic;
}
.katex .textrm {
font-family: KaTeX_Main;
}
.katex .textsf {
font-family: KaTeX_SansSerif;
}
.katex .texttt {
font-family: KaTeX_Typewriter;
}
.katex .mathnormal {
font-family: KaTeX_Math;
font-style: italic;
}
.katex .mathit {
font-family: KaTeX_Main;
font-style: italic;
}
.katex .mathrm {
font-style: normal;
}
.katex .mathbf {
font-family: KaTeX_Main;
font-weight: 700;
}
.katex .boldsymbol {
font-family: KaTeX_Math;
font-style: italic;
font-weight: 700;
}
.katex .amsrm,
.katex .mathbb,
.katex .textbb {
font-family: KaTeX_AMS;
}
.katex .mathcal {
font-family: KaTeX_Caligraphic;
}
.katex .mathfrak,
.katex .textfrak {
font-family: KaTeX_Fraktur;
}
.katex .mathboldfrak,
.katex .textboldfrak {
font-family: KaTeX_Fraktur;
font-weight: 700;
}
.katex .mathtt {
font-family: KaTeX_Typewriter;
}
.katex .mathscr,
.katex .textscr {
font-family: KaTeX_Script;
}
.katex .mathsf {
font-family: KaTeX_SansSerif;
}
.katex .mathboldsf,
.katex .textboldsf {
font-family: KaTeX_SansSerif;
font-weight: 700;
}
.katex .mathitsf,
.katex .mathsfit,
.katex .textitsf {
font-family: KaTeX_SansSerif;
font-style: italic;
}
.katex .mainrm {
font-family: KaTeX_Main;
font-style: normal;
}
/* KaTeX Layout */
.katex .vlist-t {
border-collapse: collapse;
display: inline-table;
table-layout: fixed;
}
.katex .vlist-r {
display: table-row;
}
.katex .vlist {
display: table-cell;
position: relative;
vertical-align: bottom;
}
.katex .vlist > span {
display: block;
height: 0;
position: relative;
}
.katex .vlist > span > span {
display: inline-block;
}
.katex .vlist > span > .pstrut {
overflow: hidden;
width: 0;
}
.katex .vlist-t2 {
margin-right: -2px;
}
.katex .vlist-s {
display: table-cell;
font-size: 1px;
min-width: 2px;
vertical-align: bottom;
width: 2px;
}
.katex .vbox {
align-items: baseline;
display: inline-flex;
flex-direction: column;
}
.katex .hbox {
width: 100%;
display: inline-flex;
flex-direction: row;
}
.katex .thinbox {
display: inline-flex;
flex-direction: row;
max-width: 0;
width: 0;
}
/* KaTeX Fractions and Lines */
.katex .msupsub {
text-align: left;
}
.katex .mfrac > span > span {
text-align: center;
}
.katex .mfrac .frac-line {
border-bottom-style: solid;
display: inline-block;
width: 100%;
}
.katex .hdashline,
.katex .hline,
.katex .mfrac .frac-line,
.katex .overline .overline-line,
.katex .rule,
.katex .underline .underline-line {
min-height: 1px;
}
.katex .mspace {
display: inline-block;
}
/* KaTeX Positioning */
.katex .clap,
.katex .llap,
.katex .rlap {
position: relative;
width: 0;
}
.katex .clap > .inner,
.katex .llap > .inner,
.katex .rlap > .inner {
position: absolute;
}
.katex .clap > .fix,
.katex .llap > .fix,
.katex .rlap > .fix {
display: inline-block;
}
.katex .llap > .inner {
right: 0;
}
.katex .clap > .inner,
.katex .rlap > .inner {
left: 0;
}
.katex .clap > .inner > span {
margin-left: -50%;
margin-right: 50%;
}
/* KaTeX Rules and Lines */
.katex .rule {
border: 0 solid;
display: inline-block;
position: relative;
}
.katex .hline,
.katex .overline .overline-line,
.katex .underline .underline-line {
border-bottom-style: solid;
display: inline-block;
width: 100%;
}
.katex .hdashline {
border-bottom-style: dashed;
display: inline-block;
width: 100%;
}
/* KaTeX Square Root */
.katex .sqrt > .root {
margin-left: 0.27777778em;
margin-right: -0.55555556em;
}
/* KaTeX Sizing - Essential subset */
.katex .fontsize-ensurer.reset-size1.size1,
.katex .sizing.reset-size1.size1 {
font-size: 1em;
}
.katex .fontsize-ensurer.reset-size1.size2,
.katex .sizing.reset-size1.size2 {
font-size: 1.2em;
}
.katex .fontsize-ensurer.reset-size1.size3,
.katex .sizing.reset-size1.size3 {
font-size: 1.4em;
}
.katex .fontsize-ensurer.reset-size1.size4,
.katex .sizing.reset-size1.size4 {
font-size: 1.6em;
}
.katex .fontsize-ensurer.reset-size1.size5,
.katex .sizing.reset-size1.size5 {
font-size: 1.8em;
}
.katex .fontsize-ensurer.reset-size1.size6,
.katex .sizing.reset-size1.size6 {
font-size: 2em;
}
.katex .fontsize-ensurer.reset-size1.size7,
.katex .sizing.reset-size1.size7 {
font-size: 2.4em;
}
/* KaTeX Delimiters */
.katex .delimsizing.size1 {
font-family: KaTeX_Size1;
}
.katex .delimsizing.size2 {
font-family: KaTeX_Size2;
}
.katex .delimsizing.size3 {
font-family: KaTeX_Size3;
}
.katex .delimsizing.size4 {
font-family: KaTeX_Size4;
}
.katex .nulldelimiter {
display: inline-block;
width: 0.12em;
}
.katex .delimcenter,
.katex .op-symbol {
position: relative;
}
.katex .op-symbol.small-op {
font-family: KaTeX_Size1;
}
.katex .op-symbol.large-op {
font-family: KaTeX_Size2;
}
/* KaTeX Accents and Symbols */
.katex .accent > .vlist-t,
.katex .op-limits > .vlist-t {
text-align: center;
}
.katex .accent .accent-body {
position: relative;
}
.katex .accent .accent-body:not(.accent-full) {
width: 0;
}
.katex .overlay {
display: block;
}
/* KaTeX Tables */
.katex .mtable .vertical-separator {
display: inline-block;
min-width: 1px;
}
.katex .mtable .arraycolsep {
display: inline-block;
}
.katex .mtable .col-align-c > .vlist-t {
text-align: center;
}
.katex .mtable .col-align-l > .vlist-t {
text-align: left;
}
.katex .mtable .col-align-r > .vlist-t {
text-align: right;
}
/* KaTeX SVG Support */
.katex .svg-align {
text-align: left;
}
.katex svg {
fill: currentColor;
stroke: currentColor;
fill-rule: nonzero;
fill-opacity: 1;
stroke-width: 1;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-dasharray: none;
stroke-dashoffset: 0;
stroke-opacity: 1;
display: block;
height: inherit;
position: absolute;
width: 100%;
}
.katex svg path {
stroke: none;
}
.katex img {
border-style: none;
max-height: none;
max-width: none;
min-height: 0;
min-width: 0;
}
/* KaTeX Stretchy Elements */
.katex .stretchy {
display: block;
overflow: hidden;
position: relative;
width: 100%;
}
.katex .stretchy::after,
.katex .stretchy::before {
content: "";
}
.katex .hide-tail {
overflow: hidden;
position: relative;
width: 100%;
}
/* KaTeX Arrows and Braces */
.katex .halfarrow-left {
left: 0;
overflow: hidden;
position: absolute;
width: 50.2%;
}
.katex .halfarrow-right {
overflow: hidden;
position: absolute;
right: 0;
width: 50.2%;
}
.katex .brace-left {
left: 0;
overflow: hidden;
position: absolute;
width: 25.1%;
}
.katex .brace-center {
left: 25%;
overflow: hidden;
position: absolute;
width: 50%;
}
.katex .brace-right {
overflow: hidden;
position: absolute;
right: 0;
width: 25.1%;
}
/* KaTeX Padding and Boxes */
.katex .x-arrow-pad {
padding: 0 0.5em;
}
.katex .cd-arrow-pad {
padding: 0 0.55556em 0 0.27778em;
}
.katex .mover,
.katex .munder,
.katex .x-arrow {
text-align: center;
}
.katex .boxpad {
padding: 0 0.3em;
}
.katex .fbox,
.katex .fcolorbox {
border: 0.04em solid;
box-sizing: border-box;
}
/* KaTeX Cancel */
.katex .cancel-pad {
padding: 0 0.2em;
}
.katex .cancel-lap {
margin-left: -0.2em;
margin-right: -0.2em;
}
.katex .sout {
border-bottom-style: solid;
border-bottom-width: 0.08em;
}
/* KaTeX Angles */
.katex .angl {
border-right: 0.049em solid;
border-top: 0.049em solid;
box-sizing: border-box;
margin-right: 0.03889em;
}
.katex .anglpad {
padding: 0 0.03889em;
}
/* KaTeX Equation Numbers */
.katex .eqn-num::before {
content: "(" counter(katexEqnNo) ")";
counter-increment: katexEqnNo;
}
.katex .mml-eqn-num::before {
content: "(" counter(mmlEqnNo) ")";
counter-increment: mmlEqnNo;
}
/* KaTeX Display Mode */
.katex-display {
display: block;
margin: 1em 0;
text-align: center;
}
.katex-display > .katex {
display: block;
text-align: center;
white-space: nowrap;
}
.katex-display > .katex > .katex-html {
display: block;
position: relative;
}
.katex-display > .katex > .katex-html > .tag {
position: absolute;
right: 0;
}
.katex-display.leqno > .katex > .katex-html > .tag {
left: 0;
right: auto;
}
.katex-display.fleqn > .katex {
padding-left: 2em;
text-align: left;
}
body {
counter-reset: katexEqnNo mmlEqnNo;
}
/* ============================== */
/* KaTeX Font Fallbacks */
/* For Obsidian, we'll use system fonts as fallbacks */
/* ============================== */
.katex {
font-family: "KaTeX_Main", "Times New Roman", Times, serif;
}
.katex .mathit,
.katex .mathnormal {
font-family: "KaTeX_Math", "Times New Roman", Times, serif;
font-style: italic;
}
.katex .mathbf {
font-family: "KaTeX_Main", "Times New Roman", Times, serif;
font-weight: bold;
}
.katex .amsrm,
.katex .mathbb,
.katex .textbb {
font-family: "KaTeX_AMS", "Times New Roman", Times, serif;
}
.katex .mathcal {
font-family: "KaTeX_Caligraphic", "Lucida Calligraphy", "Brush Script MT", cursive;
}
.katex .mathfrak,
.katex .textfrak {
font-family: "KaTeX_Fraktur", "Lucida Blackletter", fantasy;
}
.katex .mathtt {
font-family: "KaTeX_Typewriter", "Courier New", Courier, monospace;
}
.katex .mathscr,
.katex .textscr {
font-family: "KaTeX_Script", "Lucida Handwriting", "Segoe Script", cursive;
}
.katex .mathsf,
.katex .textsf {
font-family: "KaTeX_SansSerif", Arial, Helvetica, sans-serif;
}
/* ============================== */
/* Additional Markdown Styles */
/* ============================== */
/* Headings in assistant messages */
.message-bubble.assistant h1 {
font-size: 1.5em;
font-weight: 600;
margin: 0.67em 0;
}
.message-bubble.assistant h2 {
font-size: 1.3em;
font-weight: 600;
margin: 0.75em 0;
}
.message-bubble.assistant h3 {
font-size: 1.1em;
font-weight: 600;
margin: 0.83em 0;
}
.message-bubble.assistant h4 {
font-size: 1em;
font-weight: 600;
margin: 1.12em 0;
}
.message-bubble.assistant h5 {
font-size: 0.9em;
font-weight: 600;
margin: 1.5em 0;
}
.message-bubble.assistant h6 {
font-size: 0.85em;
font-weight: 600;
margin: 1.67em 0;
}
/* Paragraphs */
.message-bubble.assistant p {
margin: 0.5em 0;
}
/* Lists */
.message-bubble.assistant ul,
.message-bubble.assistant ol {
margin: 0.5em 0;
padding-left: 2em;
}
.message-bubble.assistant li {
margin: 0.25em 0;
}
/* Code blocks */
.message-bubble.assistant pre {
background-color: var(--code-background, #f6f8fa);
border-radius: 4px;
padding: 0.5em;
overflow-x: auto;
margin: 0.5em 0;
}
.message-bubble.assistant code {
background-color: var(--code-background, rgba(27, 31, 35, 0.05));
border-radius: 3px;
padding: 0.2em 0.4em;
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
font-size: 0.9em;
}
.message-bubble.assistant pre code {
background-color: transparent;
padding: 0;
}
/* Blockquotes */
.message-bubble.assistant blockquote {
border-left: 4px solid var(--blockquote-border, #d0d7de);
padding-left: 1em;
margin: 0.5em 0;
color: var(--text-muted);
}
/* Tables */
.message-bubble.assistant table {
border-collapse: collapse;
margin: 0.5em 0;
width: 100%;
}
.message-bubble.assistant th,
.message-bubble.assistant td {
border: 1px solid var(--table-border, #d0d7de);
padding: 0.5em;
text-align: left;
}
.message-bubble.assistant th {
background-color: var(--table-header-background, #f6f8fa);
font-weight: 600;
}
/* Links */
.message-bubble.assistant a {
color: var(--link-color, #0969da);
text-decoration: none;
}
.message-bubble.assistant a:hover {
text-decoration: underline;
}
/* Horizontal rules */
.message-bubble.assistant hr {
border: none;
border-top: 1px solid var(--hr-color, #d0d7de);
margin: 1em 0;
}
/* Images */
.message-bubble.assistant img {
max-width: 100%;
height: auto;
display: block;
margin: 0.5em 0;
}
/* Emphasis */
.message-bubble.assistant em {
font-style: italic;
}
.message-bubble.assistant strong {
font-weight: 600;
}
/* Strikethrough */
.message-bubble.assistant del {
text-decoration: line-through;
}

View file

@ -1,9 +0,0 @@
/*!
Theme: Default
Description: Original highlight.js style
Author: (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
Maintainer: @highlightjs/core-team
Website: https://highlightjs.org/
License: see project LICENSE
Touched: 2021
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#f3f3f3;color:#444}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}

373
styles/katex.min.css vendored
View file

@ -1,373 +0,0 @@
/* KaTeX CSS with CDN font URLs */
@font-face {
font-family: 'KaTeX_AMS';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_AMS-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_AMS-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Caligraphic';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Caligraphic';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Caligraphic-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Fraktur';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Fraktur';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Fraktur-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Main';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Main';
font-style: italic;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Italic.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Italic.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Main';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Main-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Math';
font-style: italic;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Math-Italic.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Math-Italic.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_SansSerif';
font-style: normal;
font-weight: 700;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Bold.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Bold.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_SansSerif';
font-style: italic;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Italic.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Italic.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_SansSerif';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_SansSerif-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Script';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Script-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Script-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size1';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size1-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size1-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size2';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size2-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size2-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size3';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size3-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size3-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Size4';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size4-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Size4-Regular.woff') format('woff');
}
@font-face {
font-family: 'KaTeX_Typewriter';
font-style: normal;
font-weight: 400;
src: url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Typewriter-Regular.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_Typewriter-Regular.woff') format('woff');
}
/* Rest of KaTeX CSS styles */
.katex {
font: normal 1.21em KaTeX_Main, Times, serif;
line-height: 1.2;
white-space: nowrap;
text-indent: 0;
text-rendering: auto;
}
.katex * {
border-color: currentColor;
}
.katex .katex-version::after {
content: "0.16.0";
}
.katex .katex-mathml {
position: absolute;
visibility: hidden;
height: 1px;
overflow: hidden;
}
.katex .katex-html > .newline {
display: block;
}
.katex .base {
position: relative;
white-space: nowrap;
width: min-content;
}
.katex .strut {
display: inline-block;
}
.katex .textbf {
font-weight: bold;
}
.katex .textit {
font-style: italic;
}
.katex .textrm {
font-family: KaTeX_Main;
}
.katex .textsf {
font-family: KaTeX_SansSerif;
}
.katex .texttt {
font-family: KaTeX_Typewriter;
}
.katex .mathnormal {
font-family: KaTeX_Math;
font-style: italic;
}
.katex .mathit {
font-family: KaTeX_Main;
font-style: italic;
}
.katex .mathrm {
font-style: normal;
}
.katex .mathbf {
font-family: KaTeX_Main;
font-weight: bold;
}
.katex .boldsymbol {
font-family: KaTeX_Math;
font-weight: bold;
font-style: italic;
}
.katex .amsrm {
font-family: KaTeX_AMS;
}
.katex .mathbb,
.katex .textbb {
font-family: KaTeX_AMS;
}
.katex .mathcal {
font-family: KaTeX_Caligraphic;
}
.katex .mathfrak,
.katex .textfrak {
font-family: KaTeX_Fraktur;
}
.katex .mathtt {
font-family: KaTeX_Typewriter;
}
.katex .mathscr,
.katex .textscr {
font-family: KaTeX_Script;
}
.katex .mathsf,
.katex .textsf {
font-family: KaTeX_SansSerif;
}
.katex .mathboldsf,
.katex .textboldsf {
font-family: KaTeX_SansSerif;
font-weight: bold;
}
.katex .mathitsf,
.katex .textitsf {
font-family: KaTeX_SansSerif;
font-style: italic;
}
.katex .mainrm {
font-family: KaTeX_Main;
font-style: normal;
}
.katex .vlist-t {
display: inline-table;
table-layout: fixed;
border-collapse: collapse;
}
.katex .vlist-r {
display: table-row;
}
.katex .vlist {
display: table-cell;
vertical-align: bottom;
position: relative;
}
.katex .vlist > span {
display: block;
height: 0;
position: relative;
}
.katex .vlist > span > span {
display: inline-block;
}
.katex .vlist > span > .pstrut {
overflow: hidden;
width: 0;
}
.katex .hlist {
display: inline-flex;
flex-direction: row;
}
.katex .hlist > span {
flex: 0 0 auto;
}
.katex .vcenter {
display: inline-block;
vertical-align: middle;
}
.katex .alignleft {
text-align: left;
}
.katex .aligncenter {
text-align: center;
}
.katex .alignright {
text-align: right;
}
.katex .gothfrak,
.katex .textgothfrak {
font-family: KaTeX_Fraktur;
}
.katex .cmr {
font-family: KaTeX_Main;
}
.katex .cmss {
font-family: KaTeX_SansSerif;
}
.katex .cmtt {
font-family: KaTeX_Typewriter;
}
.katex .katex-display {
display: block;
margin: 1em 0;
text-align: center;
}
.katex .katex-display > .katex {
display: block;
white-space: nowrap;
max-width: 100%;
overflow-x: auto;
text-align: initial;
}
.katex .katex-display.leqno > .katex {
text-align: left;
}
.katex .katex-display.fleqn > .katex {
text-align: left;
padding-left: 2em;
}

View file

@ -1,153 +0,0 @@
/* Import the downloaded CSS files */
@import './katex.min.css';
@import './highlight-default.min.css';
/* Additional markdown styling for Obsidian plugin */
.markdown-processor-content {
line-height: 1.6;
color: var(--text-normal);
}
.markdown-processor-content h1,
.markdown-processor-content h2,
.markdown-processor-content h3,
.markdown-processor-content h4,
.markdown-processor-content h5,
.markdown-processor-content h6 {
margin: 1rem 0 0.5rem 0;
color: var(--text-normal);
font-weight: var(--font-weight-bold);
}
.markdown-processor-content h1 { font-size: 1.5em; }
.markdown-processor-content h2 { font-size: 1.3em; }
.markdown-processor-content h3 { font-size: 1.1em; }
.markdown-processor-content p {
margin: 0.5rem 0;
}
.markdown-processor-content pre {
background-color: var(--background-primary-alt);
padding: 1rem;
border-radius: var(--radius-s);
overflow-x: auto;
margin: 0.5rem 0;
border: 1px solid var(--background-modifier-border);
}
.markdown-processor-content code {
background-color: var(--background-primary-alt);
padding: 2px 4px;
border-radius: var(--radius-s);
font-family: var(--font-monospace);
font-size: 0.9em;
}
.markdown-processor-content pre code {
background-color: transparent;
padding: 0;
}
.markdown-processor-content blockquote {
border-left: 4px solid var(--background-modifier-border);
margin: 1rem 0;
padding-left: 1rem;
color: var(--text-muted);
font-style: italic;
}
.markdown-processor-content ul,
.markdown-processor-content ol {
padding-left: 1.5rem;
margin: 0.5rem 0;
}
.markdown-processor-content li {
margin: 0.25rem 0;
}
.markdown-processor-content table {
border-collapse: collapse;
width: 100%;
margin: 1rem 0;
border: 1px solid var(--background-modifier-border);
}
.markdown-processor-content th,
.markdown-processor-content td {
border: 1px solid var(--background-modifier-border);
padding: 8px 12px;
text-align: left;
}
.markdown-processor-content th {
background-color: var(--background-primary-alt);
font-weight: var(--font-weight-bold);
}
.markdown-processor-content a {
color: var(--text-accent);
text-decoration: none;
}
.markdown-processor-content a:hover {
text-decoration: underline;
}
/* Math content styling adjustments for Obsidian */
.markdown-processor-content .katex {
font-size: 1.1em;
}
.markdown-processor-content .katex-display {
margin: 1rem 0;
text-align: center;
}
/* Task list styling */
.markdown-processor-content input[type="checkbox"] {
margin-right: 0.5rem;
}
/* Footnotes styling */
.markdown-processor-content .footnotes {
margin-top: 2rem;
padding-top: 1rem;
border-top: 1px solid var(--background-modifier-border);
font-size: 0.9em;
}
/* Override highlight.js colors to use Obsidian theme colors */
.markdown-processor-content .hljs {
background: var(--background-primary-alt) !important;
color: var(--text-normal) !important;
}
.markdown-processor-content .hljs-comment,
.markdown-processor-content .hljs-quote {
color: var(--text-muted) !important;
}
.markdown-processor-content .hljs-keyword,
.markdown-processor-content .hljs-selector-tag,
.markdown-processor-content .hljs-literal {
color: var(--text-accent) !important;
}
.markdown-processor-content .hljs-string,
.markdown-processor-content .hljs-doctag {
color: var(--color-green) !important;
}
.markdown-processor-content .hljs-title,
.markdown-processor-content .hljs-section,
.markdown-processor-content .hljs-type {
color: var(--color-blue) !important;
}
.markdown-processor-content .hljs-number,
.markdown-processor-content .hljs-variable,
.markdown-processor-content .hljs-template-variable {
color: var(--color-purple) !important;
}

179
styles_old.css Normal file
View file

@ -0,0 +1,179 @@
/* Enhanced code block styling with better spacing */
pre {
background-color: var(--background-secondary);
border: 1px solid var(--background-modifier-border);
border-radius: 6px;
padding: 1rem;
overflow-x: auto;
margin: 1rem 0;
line-height: 1.4; /* Better line spacing */
font-size: 0.875rem; /* Slightly larger for readability */
}
pre code {
font-family: var(--font-monospace);
font-size: inherit;
background: none; /* Remove any inherited background */
padding: 0; /* Remove any inherited padding */
border: none;
display: block;
white-space: pre; /* Preserve all whitespace and indentation */
word-wrap: normal;
overflow-wrap: normal;
}
/* Fix indentation preservation */
.hljs {
display: block;
overflow-x: auto;
padding: 0;
background: transparent;
tab-size: 4; /* Set consistent tab size */
-moz-tab-size: 4;
}
/* Ensure proper spacing for inline elements */
.hljs * {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
/* Syntax highlighting colors (keep your existing colors) */
.hljs-keyword, [data-token="keyword"] {
color: #ff7b72;
}
.hljs-string, [data-token="string"] {
color: #a5d6ff;
}
.hljs-comment, [data-token="comment"] {
color: #8b949e;
font-style: italic;
}
.hljs-number, [data-token="number"] {
color: #79c0ff;
}
.hljs-function, [data-token="function"] {
color: #d2a8ff;
}
.hljs-variable, [data-token="variable"] {
color: #ffa657;
}
.hljs-built_in, [data-token="builtin"] {
color: #ff7b72;
}
.hljs-title, [data-token="title"] {
color: #7ee787;
}
/* Additional fixes for better formatting */
.hljs-params {
color: var(--text-normal);
}
.hljs-attr {
color: #79c0ff;
}
.hljs-punctuation {
color: var(--text-muted);
}
/* Method/function calls */
.hljs-title.function_ {
color: #d2a8ff;
}
/* Variable names and identifiers */
.hljs-variable, .hljs-name {
color: #79c0ff;
}
/* Built-in functions and methods */
.hljs-built_in, .hljs-title.function {
color: #ffa657;
}
/* Property access and attributes */
.hljs-property, .hljs-attr {
color: #79c0ff;
}
/* Operators */
.hljs-operator {
color: #ff7b72;
}
/* Punctuation and delimiters */
.hljs-punctuation {
color: var(--text-normal);
}
/* Language-specific: Python function definitions */
.hljs-title.class_ {
color: #7ee787;
}
/* Parameters in function definitions */
.hljs-params {
color: #ffa657;
}
/* Literals and constants */
.hljs-literal, .hljs-constant {
color: #79c0ff;
}
/* Class names */
.hljs-class .hljs-title {
color: #7ee787;
}
/* Module/import names */
.hljs-module {
color: #ffa657;
}
/* Meta information (like decorators) */
.hljs-meta {
color: #8b949e;
}
/* Type annotations */
.hljs-type {
color: #7ee787;
}
.hljs-section { color: #7ee787; }
.hljs-tag { color: #ff7b72; }
.hljs-link { color: #a5d6ff; }
.hljs-subst { color: var(--text-normal); }
.hljs-formula { color: #a5d6ff; }
.hljs-addition { color: #7ee787; background-color: rgba(46, 160, 67, 0.15); }
.hljs-deletion { color: #ff7b72; background-color: rgba(248, 81, 73, 0.15); }
.hljs-selector-id, .hljs-selector-class { color: #7ee787; }
.hljs-doctag, .hljs-strong { font-weight: bold; }
.hljs-emphasis { font-style: italic; }
/* Ensure bold text renders properly */
strong, b {
font-weight: bold;
color: var(--text-normal);
}
em, i {
font-style: italic;
}
/* For markdown-rendered content specifically */
.markdown-rendered strong,
.markdown-rendered b {
font-weight: 600 !important;
}