Compare commits

..

5 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
18810bb86f Address code review feedback - improve outputSubDir handling
Improved the importAndExportDocs function to better handle the empty outputSubDir case:
- Use meaningful name for temporary zip file ('user-guide' instead of '')
- Explicitly handle empty outputSubDir for root directory output
- Added comments to clarify the behavior

Co-authored-by: eliandoran <21236836+eliandoran@users.noreply.github.com>
2025-11-02 22:31:25 +00:00
copilot-swe-agent[bot]
4f442551a9 Integrate Developer Guide into documentation build process
Added Developer Guide to the documentation build process alongside the User Guide.
- Modified build-docs.ts to import and export both User Guide and Developer Guide
- Created importAndExportDocs helper function to handle multiple documentation sources
- Developer Guide is exported to /site/developer-guide/ subdirectory
- Updated GitHub workflow to validate Developer Guide is built
- Added build-docs app to workflow triggers

The documentation build now produces:
- User Guide at /site/ (root) and /site/user-guide/
- Developer Guide at /site/developer-guide/
- Script API at /site/script-api/{backend,frontend}/
- REST API at /site/rest-api/{internal,etapi}/

Co-authored-by: eliandoran <21236836+eliandoran@users.noreply.github.com>
2025-11-02 22:28:24 +00:00
copilot-swe-agent[bot]
a8f565d912 Remove build artifacts from git and update .gitignore 2025-11-02 22:23:43 +00:00
copilot-swe-agent[bot]
0c6a57d3bb Fix documentation build system - resolve becca module instance issue
Fixed the issue where multiple becca instances were being created due to inconsistent module import paths. The solution was to export becca from becca_loader and access it from there, ensuring a single instance is used throughout the build process.

Co-authored-by: eliandoran <21236836+eliandoran@users.noreply.github.com>
2025-11-02 22:18:49 +00:00
copilot-swe-agent[bot]
01deab9c79 Initial plan 2025-11-02 21:57:43 +00:00
13 changed files with 459 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ on:
paths:
- 'docs/**'
- 'apps/edit-docs/**'
- 'apps/build-docs/**'
- 'packages/share-theme/**'
# Allow manual triggering from Actions tab
@@ -23,6 +24,7 @@ on:
paths:
- 'docs/**'
- 'apps/edit-docs/**'
- 'apps/build-docs/**'
- 'packages/share-theme/**'
jobs:
@@ -60,6 +62,8 @@ jobs:
- name: Validate Built Site
run: |
test -f site/index.html || (echo "ERROR: site/index.html not found" && exit 1)
test -f site/developer-guide/index.html || (echo "ERROR: site/developer-guide/index.html not found" && exit 1)
echo "✓ User Guide and Developer Guide built successfully"
- name: Deploy
uses: ./.github/actions/deploy-to-cloudflare-pages

View File

@@ -14,17 +14,12 @@ import BuildContext from "./context.js";
const DOCS_ROOT = "../../../docs";
const OUTPUT_DIR = "../../site";
async function buildDocsInner() {
const i18n = await import("@triliumnext/server/src/services/i18n.js");
await i18n.initializeTranslations();
const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
await sqlInit.createInitialDatabase(true);
const note = await importData(join(__dirname, DOCS_ROOT, "User Guide"));
// Export
const zipFilePath = "output.zip";
async function importAndExportDocs(sourcePath: string, outputSubDir: string) {
const note = await importData(sourcePath);
// Use a meaningful name for the temporary zip file
const zipName = outputSubDir || "user-guide";
const zipFilePath = `output-${zipName}.zip`;
try {
const { exportToZip } = (await import("@triliumnext/server/src/services/export/zip.js")).default;
const branch = note.getParentBranches()[0];
@@ -36,12 +31,35 @@ async function buildDocsInner() {
const fileOutputStream = fsExtra.createWriteStream(zipFilePath);
await exportToZip(taskContext, branch, "share", fileOutputStream);
await waitForStreamToFinish(fileOutputStream);
await extractZip(zipFilePath, OUTPUT_DIR);
// Output to root directory if outputSubDir is empty, otherwise to subdirectory
const outputPath = outputSubDir ? join(OUTPUT_DIR, outputSubDir) : OUTPUT_DIR;
await extractZip(zipFilePath, outputPath);
} finally {
if (await fsExtra.exists(zipFilePath)) {
await fsExtra.rm(zipFilePath);
}
}
}
async function buildDocsInner() {
const i18n = await import("@triliumnext/server/src/services/i18n.js");
await i18n.initializeTranslations();
const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
await sqlInit.createInitialDatabase(true);
// Wait for becca to be loaded before importing data
const beccaLoader = await import("../../server/src/becca/becca_loader.js");
await beccaLoader.beccaLoaded;
// Build User Guide
console.log("Building User Guide...");
await importAndExportDocs(join(__dirname, DOCS_ROOT, "User Guide"), "");
// Build Developer Guide
console.log("Building Developer Guide...");
await importAndExportDocs(join(__dirname, DOCS_ROOT, "Developer Guide"), "developer-guide");
// Copy favicon.
await fs.copyFile("../../apps/website/src/assets/favicon.ico", join(OUTPUT_DIR, "favicon.ico"));
@@ -51,11 +69,12 @@ async function buildDocsInner() {
export async function importData(path: string) {
const buffer = await createImportZip(path);
const importService = (await import("@triliumnext/server/src/services/import/zip.js")).default;
const TaskContext = (await import("@triliumnext/server/src/services/task_context.js")).default;
const importService = (await import("../../server/src/services/import/zip.js")).default;
const TaskContext = (await import("../../server/src/services/task_context.js")).default;
const context = new TaskContext("no-progress-reporting", "importNotes", null);
const becca = (await import("@triliumnext/server/src/becca/becca.js")).default;
const beccaLoader = (await import("../../server/src/becca/becca_loader.js")).default;
const becca = beccaLoader.becca;
const rootNote = becca.getRoot();
if (!rootNote) {
throw new Error("Missing root note for import.");

View File

@@ -293,5 +293,6 @@ eventService.subscribeBeccaLoader(eventService.LEAVE_PROTECTED_SESSION, load);
export default {
load,
reload,
beccaLoaded
beccaLoaded,
becca
};

View File

@@ -158,11 +158,13 @@ function startHttpServer(app: Express) {
// Not all situations require showing an error dialog. When Trilium is already open,
// clicking the shortcut, the software icon, or the taskbar icon, or when creating a new window,
// should simply focus on the existing window or open a new one, without displaying an error message.
if ("code" in error && error.code === "EADDRINUSE" && (process.argv.includes("--new-window") || !app.requestSingleInstanceLock())) {
console.error(message);
} else {
dialog.showErrorBox("Error while initializing the server", message);
if ("code" in error && error.code == "EADDRINUSE") {
if (process.argv.includes("--new-window") || !app.requestSingleInstanceLock()) {
console.error(message);
process.exit(1);
}
}
dialog.showErrorBox("Error while initializing the server", message);
process.exit(1);
});
} else {

View File

@@ -0,0 +1,81 @@
import { ClassicEditor, Autoformat, Base64UploadAdapter, BlockQuote, Bold, Code, CodeBlock, Essentials, Heading, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Indent, Italic, Link, List, MediaEmbed, Paragraph, Table, TableToolbar } from 'ckeditor5';
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
import Admonition from '../src/admonition.js';
import 'ckeditor5/ckeditor5.css';
ClassicEditor
.create(document.getElementById('editor'), {
licenseKey: 'GPL',
plugins: [
Admonition,
Essentials,
Autoformat,
BlockQuote,
Bold,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Italic,
Link,
List,
MediaEmbed,
Paragraph,
Table,
TableToolbar,
CodeBlock,
Code,
Base64UploadAdapter
],
toolbar: [
'undo',
'redo',
'|',
'admonition',
'|',
'heading',
'|',
'bold',
'italic',
'link',
'code',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'uploadImage',
'blockQuote',
'insertTable',
'mediaEmbed',
'codeBlock'
],
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
})
.then(editor => {
window.editor = editor;
CKEditorInspector.attach(editor);
window.console.log('CKEditor 5 is ready.', editor);
})
.catch(err => {
window.console.error(err.stack);
});
//# sourceMappingURL=ckeditor.js.map

View File

@@ -0,0 +1,81 @@
import { ClassicEditor, Autoformat, Base64UploadAdapter, BlockQuote, Bold, Code, CodeBlock, Essentials, Heading, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Indent, Italic, Link, List, MediaEmbed, Paragraph, Table, TableToolbar } from 'ckeditor5';
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
import Footnotes from '../src/footnotes.js';
import 'ckeditor5/ckeditor5.css';
ClassicEditor
.create(document.getElementById('editor'), {
licenseKey: 'GPL',
plugins: [
Footnotes,
Essentials,
Autoformat,
BlockQuote,
Bold,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Italic,
Link,
List,
MediaEmbed,
Paragraph,
Table,
TableToolbar,
CodeBlock,
Code,
Base64UploadAdapter
],
toolbar: [
'undo',
'redo',
'|',
'footnotes',
'|',
'heading',
'|',
'bold',
'italic',
'link',
'code',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'uploadImage',
'blockQuote',
'insertTable',
'mediaEmbed',
'codeBlock'
],
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
})
.then(editor => {
window.editor = editor;
CKEditorInspector.attach(editor);
window.console.log('CKEditor 5 is ready.', editor);
})
.catch(err => {
window.console.error(err.stack);
});
//# sourceMappingURL=ckeditor.js.map

View File

@@ -0,0 +1,81 @@
import { ClassicEditor, Autoformat, Base64UploadAdapter, BlockQuote, Bold, Code, CodeBlock, Essentials, Heading, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Indent, Italic, Link, List, MediaEmbed, Paragraph, Table, TableToolbar } from 'ckeditor5';
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
import Kbd from '../src/kbd.js';
import 'ckeditor5/ckeditor5.css';
ClassicEditor
.create(document.getElementById('editor'), {
licenseKey: 'GPL',
plugins: [
Kbd,
Essentials,
Autoformat,
BlockQuote,
Bold,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Italic,
Link,
List,
MediaEmbed,
Paragraph,
Table,
TableToolbar,
CodeBlock,
Code,
Base64UploadAdapter
],
toolbar: [
'undo',
'redo',
'|',
'keyboardMarker',
'|',
'heading',
'|',
'bold',
'italic',
'link',
'code',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'uploadImage',
'blockQuote',
'insertTable',
'mediaEmbed',
'codeBlock'
],
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
})
.then(editor => {
window.editor = editor;
CKEditorInspector.attach(editor);
window.console.log('CKEditor 5 is ready.', editor);
})
.catch(err => {
window.console.error(err.stack);
});
//# sourceMappingURL=ckeditor.js.map

View File

@@ -0,0 +1,81 @@
import { ClassicEditor, Autoformat, Base64UploadAdapter, BlockQuote, Bold, Code, CodeBlock, Essentials, Heading, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Indent, Italic, Link, List, MediaEmbed, Paragraph, Table, TableToolbar } from 'ckeditor5';
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
import Math from '../src/math.js';
import 'ckeditor5/ckeditor5.css';
ClassicEditor
.create(document.getElementById('editor'), {
licenseKey: 'GPL',
plugins: [
Math,
Essentials,
Autoformat,
BlockQuote,
Bold,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Italic,
Link,
List,
MediaEmbed,
Paragraph,
Table,
TableToolbar,
CodeBlock,
Code,
Base64UploadAdapter
],
toolbar: [
'undo',
'redo',
'|',
'math',
'|',
'heading',
'|',
'bold',
'italic',
'link',
'code',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'uploadImage',
'blockQuote',
'insertTable',
'mediaEmbed',
'codeBlock'
],
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
})
.then(editor => {
window.editor = editor;
CKEditorInspector.attach(editor);
window.console.log('CKEditor 5 is ready.', editor);
})
.catch(err => {
window.console.error(err.stack);
});
//# sourceMappingURL=ckeditor.js.map

View File

@@ -0,0 +1,81 @@
import { ClassicEditor, Autoformat, Base64UploadAdapter, BlockQuote, Bold, Code, CodeBlock, Essentials, Heading, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Indent, Italic, Link, List, MediaEmbed, Paragraph, Table, TableToolbar } from 'ckeditor5';
import CKEditorInspector from '@ckeditor/ckeditor5-inspector';
import Mermaid from '../src/mermaid.js';
import 'ckeditor5/ckeditor5.css';
ClassicEditor
.create(document.getElementById('editor'), {
licenseKey: 'GPL',
plugins: [
Mermaid,
Essentials,
Autoformat,
BlockQuote,
Bold,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Italic,
Link,
List,
MediaEmbed,
Paragraph,
Table,
TableToolbar,
CodeBlock,
Code,
Base64UploadAdapter
],
toolbar: [
'undo',
'redo',
'|',
'mermaid',
'|',
'heading',
'|',
'bold',
'italic',
'link',
'code',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'uploadImage',
'blockQuote',
'insertTable',
'mediaEmbed',
'codeBlock'
],
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
})
.then(editor => {
window.editor = editor;
CKEditorInspector.attach(editor);
window.console.log('CKEditor 5 is ready.', editor);
})
.catch(err => {
window.console.error(err.stack);
});
//# sourceMappingURL=ckeditor.js.map

View File

@@ -0,0 +1,3 @@
import "highlight.js/styles/default.css";
import "@triliumnext/ckeditor5/src/theme/ck-content.css";
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAQA,OAAO,iCAAiC,CAAC;AACzC,OAAO,iDAAiD,CAAC"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":""}