Merge branch 'main' of https://github.com/TriliumNext/Trilium into feat/ui/general-improvements

This commit is contained in:
Adorian Doran 2026-02-27 19:34:41 +02:00
commit a47de6c65c
14 changed files with 229 additions and 222 deletions

View File

@ -3,5 +3,5 @@
DIR=`dirname "$0"`
export NODE_TLS_REJECT_UNAUTHORIZED=0
"$DIR/trilium"
exec "$DIR/trilium"

View File

@ -3,5 +3,5 @@
DIR=`dirname "$0"`
export TRILIUM_DATA_DIR="$DIR/trilium-data"
"$DIR/trilium"
exec "$DIR/trilium"

View File

@ -3,5 +3,5 @@
DIR=`dirname "$0"`
export TRILIUM_SAFE_MODE=1
"$DIR/trilium" --disable-gpu
exec "$DIR/trilium" --disable-gpu

View File

@ -43,7 +43,7 @@ rm -rf $BUILD_DIR/node/lib/node_modules/{npm,corepack} \
$BUILD_DIR/node_modules/electron* \
$BUILD_DIR/electron*.{js,map}
printf "#!/bin/sh\n./node/bin/node main.cjs\n" > $BUILD_DIR/trilium.sh
printf "#!/bin/sh\nexec ./node/bin/node main.cjs\n" > $BUILD_DIR/trilium.sh
chmod 755 $BUILD_DIR/trilium.sh
VERSION=`jq -r ".version" package.json`

View File

@ -179,10 +179,10 @@ describe("Markdown export", () => {
> [!IMPORTANT]
> This is a very important information.
>${space}
> | | |
> | | |
> | --- | --- |
> | 1 | 2 |
> | 3 | 4 |
> | 1 | 2 |
> | 3 | 4 |
> [!CAUTION]
> This is a caution.
@ -374,10 +374,10 @@ describe("Markdown export", () => {
</figure>
`;
const expected = trimIndentation`\
| | |
| | |
| --- | --- |
| Hi | there |
| Hi | there |`;
| Hi | there |
| Hi | there |`;
expect(markdownExportService.toMarkdown(html)).toBe(expected);
});

View File

@ -50,7 +50,7 @@
"@triliumnext/server": "workspace:*",
"@types/express": "5.0.6",
"@types/js-yaml": "4.0.9",
"@types/node": "24.10.13",
"@types/node": "24.10.14",
"@vitest/browser-webdriverio": "4.0.18",
"@vitest/coverage-v8": "4.0.18",
"@vitest/ui": "4.0.18",

View File

@ -33,7 +33,7 @@
"eslint-config-ckeditor5": ">=9.1.0",
"http-server": "14.1.1",
"lint-staged": "16.2.7",
"stylelint": "17.3.0",
"stylelint": "17.4.0",
"stylelint-config-ckeditor5": ">=9.1.0",
"ts-node": "10.9.2",
"typescript": "5.9.3",

View File

@ -34,7 +34,7 @@
"eslint-config-ckeditor5": ">=9.1.0",
"http-server": "14.1.1",
"lint-staged": "16.2.7",
"stylelint": "17.3.0",
"stylelint": "17.4.0",
"stylelint-config-ckeditor5": ">=9.1.0",
"ts-node": "10.9.2",
"typescript": "5.9.3",

View File

@ -36,7 +36,7 @@
"eslint-config-ckeditor5": ">=9.1.0",
"http-server": "14.1.1",
"lint-staged": "16.2.7",
"stylelint": "17.3.0",
"stylelint": "17.4.0",
"stylelint-config-ckeditor5": ">=9.1.0",
"ts-node": "10.9.2",
"typescript": "5.9.3",

View File

@ -36,7 +36,7 @@
"eslint-config-ckeditor5": ">=9.1.0",
"http-server": "14.1.1",
"lint-staged": "16.2.7",
"stylelint": "17.3.0",
"stylelint": "17.4.0",
"stylelint-config-ckeditor5": ">=9.1.0",
"ts-node": "10.9.2",
"typescript": "5.9.3",

View File

@ -36,7 +36,7 @@
"eslint-config-ckeditor5": ">=9.1.0",
"http-server": "14.1.1",
"lint-staged": "16.2.7",
"stylelint": "17.3.0",
"stylelint": "17.4.0",
"stylelint-config-ckeditor5": ">=9.1.0",
"ts-node": "10.9.2",
"typescript": "5.9.3",

View File

@ -96,7 +96,8 @@ rules.table = {
var columnCount = tableColCount(node);
var emptyHeader = ''
if (columnCount && !secondLineIsDivider) {
emptyHeader = '|' + ' |'.repeat(columnCount) + '\n' + '|'
// MD060 compact style: 2 spaces between pipes for empty cells
emptyHeader = '|' + ' |'.repeat(columnCount) + '\n' + '|'
for (var columnIndex = 0; columnIndex < columnCount; ++columnIndex) {
emptyHeader += ' ' + getBorder(getColumnAlignment(node, columnIndex)) + ' |';
}
@ -157,13 +158,15 @@ function isFirstTbody (element) {
)
}
// Format table cells following MD060 compact style:
// Each cell has 1 space padding on left and right (prefix + content + ' |').
// Empty cells result in 2 spaces between pipes (1 left + 1 right padding).
function cell (content, node = null, index = null) {
if (index === null) index = indexOf.call(node.parentNode.childNodes, node)
var prefix = ' '
if (index === 0) prefix = '| '
let filteredContent = content.trim().replace(/\n\r/g, '<br>').replace(/\n/g, "<br>");
filteredContent = filteredContent.replace(/\|+/g, '\\|')
while (filteredContent.length < 3) filteredContent += ' ';
if (node) filteredContent = handleColSpan(filteredContent, node, ' ');
return prefix + filteredContent + ' |'
}
@ -259,7 +262,7 @@ function nodeParentTable(node) {
function handleColSpan(content, node, emptyChar) {
const colspan = node.getAttribute('colspan') || 1;
for (let i = 1; i < colspan; i++) {
content += ' | ' + emptyChar.repeat(3);
content += ' |' + emptyChar;
}
return content
}

View File

@ -141,11 +141,11 @@
</div>
<pre class="expected">| Column 1 | Column 2 | Column 3 | Column 4 |
| --- | --- | --- | --- |
| | Row 1, Column 2 | Row 1, Column 3 | Row 1, Column 4 |
| Row 2, Column 1 | | Row 2, Column 3 | Row 2, Column 4 |
| Row 3, Column 1 | Row 3, Column 2 | | Row 3, Column 4 |
| Row 4, Column 1 | Row 4, Column 2 | Row 4, Column 3 | |
| | | | Row 5, Column 4 |</pre>
| | Row 1, Column 2 | Row 1, Column 3 | Row 1, Column 4 |
| Row 2, Column 1 | | Row 2, Column 3 | Row 2, Column 4 |
| Row 3, Column 1 | Row 3, Column 2 | | Row 3, Column 4 |
| Row 4, Column 1 | Row 4, Column 2 | Row 4, Column 3 | |
| | | | Row 5, Column 4 |</pre>
</div>
<div class="case" data-name="empty rows">
@ -174,7 +174,7 @@
<pre class="expected">| Heading 1 | Heading 2 |
| --- | --- |
| Row 1 | Row 1 |
| | |
| | |
| Row 3 | Row 3 |</pre>
</div>
@ -259,7 +259,7 @@
<tbody><tr><th>Heading</th></tr></tbody>
</table>
</div>
<pre class="expected">| |
<pre class="expected">| |
| --- |
| Heading |
| --- |</pre>
@ -272,7 +272,7 @@
<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
</table>
</div>
<pre class="expected">| | |
<pre class="expected">| | |
| --- | --- |
| Row 1 Cell 1 | Row 1 Cell 2 |
| Row 2 Cell 1 | Row 2 Cell 2 |</pre>
@ -291,7 +291,7 @@
</tr>
</table>
</div>
<pre class="expected">| | |
<pre class="expected">| | |
| --- | --- |
| Heading | Not a heading |
| Heading | Not a heading |</pre>

392
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff