Now with a description and basic color scheme. Saving before making some more changes.

This commit is contained in:
Scott Idem
2025-04-03 18:27:59 -04:00
parent 2ab026611f
commit e022645f64
7 changed files with 125 additions and 8 deletions

View File

@@ -2,6 +2,7 @@ import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { db_journals } from "$lib/ae_journals/db_journals";
import { marked } from 'marked';
import { load_ae_obj_li__journal_entry } from "$lib/ae_journals/ae_journals__journal_entry";
@@ -536,6 +537,12 @@ export function db_save_ae_obj_li__journal(
console.log(`ae_obj ${obj_type}:`, obj);
}
let description = obj.description ?? '';
// remove the most common zerowidth characters from the start of the file
let description_cleaned: string = description.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
let description_md_html: null|string = await marked.parse(description_cleaned ?? '') ?? null;
// let description_md_html_alt: null|string = await marked.parse(description_cleaned ?? '', { gfm: false }) ?? null;
try {
const id_random = await db_journals.journal.put({
id: obj.journal_id_random,
@@ -557,6 +564,7 @@ export function db_save_ae_obj_li__journal(
outline: obj.outline,
description: obj.description,
description_md_html: description_md_html, // Use the markdown parser to generate HTML
description_html: obj.description_html,
description_json: obj.description_json,

View File

@@ -41,6 +41,8 @@ export interface Journal {
outline?: null|string; // LLM (AI) generated outline...???
description?: null|string;
description_md_html?: null|string; // Markdown converted to HTML based on description. Uses marked or similar library for conversion.
description_md_html_alt?: null|string; // Markdown converted to HTML based on description. Uses marked or similar library for conversion.
description_html?: null|string;
description_json?: null|string;
@@ -182,8 +184,8 @@ export interface Journal_Entry {
// description?: null|string; // This is the description of the journal entry
content?: null|string;
content_md_html?: null|string; // Markdown converted to HTML based on content
content_md_html_alt?: null|string; // Markdown converted to HTML based on content
content_md_html?: null|string; // Markdown converted to HTML based on content. Uses marked or similar library for conversion.
content_md_html_alt?: null|string; // Markdown converted to HTML based on content. Uses marked or similar library for conversion.
content_html?: null|string;
content_json?: null|string;