Commit Graph
2974 Commits
Author SHA1 Message Date
Zef Hemel ec40aa0838 Add action buttons to flashNotification
Used by upgrade notification
2026-03-10 16:07:25 +01:00
Zef Hemel 73d657d652 Remove format checking as part of make check 2026-03-10 14:05:07 +01:00
Zef Hemel d9f4b93795 Eliminate (most) uses of the client global
Also an opportunity to refactor the transclusion code, which had become
very messy
2026-03-10 14:02:05 +01:00
Zef Hemel 6b461aa5f3 Changelog and outline website doc update 2026-03-10 13:04:41 +01:00
Zef Hemel fd1a81b8d8 Client refactor: move UI related APIs to editor_ui.ts 2026-03-10 12:42:26 +01:00
Zef Hemel 6d33d3d8ac Refactor: extract page/document manager into separate class 2026-03-10 12:33:34 +01:00
Zef Hemel cb9f954bc7 Refactor: extract widget cache from Client class 2026-03-10 12:17:02 +01:00
Zef Hemel 822997fd5e Client available upgrade notification
If the server is updated, but the client doesn't match the server
version, a notification will appear instructing the user to reload.
2026-03-10 12:05:33 +01:00
Zef Hemel c2d42849a9 A few more format and type fixes 2026-03-10 09:42:48 +01:00
Zef Hemel 799e27a9b4 Enable biome based formatter and reformat 2026-03-10 09:38:59 +01:00
Zef HemelandGitHub a0b79e7c1d Merge pull request #1839 from silverbulletmd/to-node
Migration Deno -> Node.js
2026-03-10 09:11:32 +01:00
Zef Hemel 21e846ba09 Docs fix 2026-03-10 09:00:30 +01:00
Zef Hemel cce5b669f6 Merge branch 'main' into to-node 2026-03-10 08:57:58 +01:00
Zef HemelandGitHub 6de5b1ed14 Merge pull request #1876 from mjf/improve-widget-rendering
Improve Lua Widget Rendering
2026-03-10 08:42:51 +01:00
Zef HemelandGitHub c02594f20c Merge pull request #1865 from Dobli/collapsible-toc
Make ToC widget collapsible
2026-03-10 08:42:01 +01:00
Zef Hemel a59fb566ae Add table row support also to outline commands
As requested in #1051
2026-03-09 14:58:02 +01:00
Zef Hemel dbe9e702aa Thorough redo of the outline operation commands
Fixes #606 and #908 improves #1051,
2026-03-09 14:52:06 +01:00
Matouš Jan Fialka 9c9ca047f0 Fix: Handle tagged floats before plain object check in renderCellContent
Tagged floats (`{value: N, isFloat: true}`) were matched by
`isPlainObject` and rendered as a two-column table with "value" and
"isFloat" headers instead of as a formatted number. This is now fixed.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-09 12:57:53 +01:00
Matouš Jan Fialka 2aaa797bda Improve Lua Widget Rendering
Lua `${...}` expression results are rendered using two parallel paths:

- **HTML path** (display path) for visual display in the editor and
- **Markdown path** (copy path) for the *copy button* output.

Every Lua value is classified as one of:

- **Scalar:** number, string, boolean, or `nil`
- **Empty table:** `{}`
- **Array:** a `LuaTable` with only sequential integer keys (no string keys)
- **Array of tables:** an array where every element is a `LuaTable`
- **Record:** a `LuaTable` with any string key (may also have integer keys)

Scalars are rendered as inline Markdown - wiki links, tags, bold, and
other inline syntax are resolved, `nil` renders as `<span data-empty>`.

Empty tables render as `<table data-table-empty>`.

An array of tables renders as a multi-row `<table>`. Column headers
are the union of all element keys. Each cell value recurses through
the same classification.

An array of scalars (or a mix of scalars and tables) renders as `<ul>`
with one `<li>` per element. Each item value recurses.

A record renders as a single-row `<table>` with one column per key.
Cell values recurse.

Every `<td>` carries `data-table-cell-type` and optionally
`data-table-cell-empty`.  Every `<li>` carries `data-list-item-type` and
optionally `data-list-item-empty`.  The outermost element carries
`data-type`.  These attributes allow CSS styling of rendered widgets.

Nesting is **unlimited**. Tables inside cells, lists inside cells,
tables inside list items all render correctly in HTML.

Scalars render as plain text. Lua `nil` renders as `nil`. Empty tables
render as `*(empty table)*`.

An array of tables renders as a pipe-delimited Markdown table. Nested
values in cells are rendered as Lua literals via `toStringAsync()`
(e.g. `{1, 2, 3}` or `{a = 1}`), since Markdown table cells cannot
contain block-level content.

An array of scalars renders as a Markdown list (`- item`). When a list
item is itself multi-line (a sublist) it uses an empty bullet with
two-space indented content on the next line:

```
- 1
- 2
-
  - nested 1
  - nested 2
```

Nested tables or arrays **beyond the first list nesting** level are
rendered as Lua literals.

A record renders as a single-row Markdown table.

Column headers follow the order returned by `LuaTable.keys`: string keys
in their insertion order, followed by integer keys in ascending order.
For example, `{a = 1, b = 2, 3, d = 4}` produces columns `a
| b | d | 1`. This is consequence of `LuaTable` storing string keys
and the array part separately (for performance).

Arrays mixing plain scalars and record-like tables (e.g.  `{1, 2, 3,
{a=3}}`) were previously rendered as a single flat table due to an
internal JS conversion (`toJS`). They now render as a list, with record
elements shown as nested tables - which more accurately reflects their
Lua structure. This is the only divergence from the original
presentation.

To restore the old tabular layout, wrap all elements as records with
a consistent key:

```lua
-- Before (was a flat table, now a list with nested table):
${{1, 2, 3, {a=3}}}

-- After (explicit records, renders as a table):
${{{value=1}, {value=2}, {value=3}, {a=3}}}
```

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-09 11:45:04 +01:00
Zef Hemel a5c9227499 deno fmt 2026-03-08 16:11:29 +01:00
Zef Hemel 6ad4878748 Fixes #1722 (clean completed tasks)
Refactors logic to be more testable. Now handles more scenarios.
2026-03-08 16:11:14 +01:00
Zef Hemel 0452910b0b Fixes #1777 2026-03-08 16:00:18 +01:00
Zef Hemel bbcd9ac6aa Introduce new noFloatingPromises lint rule and fix violiations 2026-03-08 15:49:45 +01:00
Zef Hemel 5c9dba30de Merge branch 'main' into to-node 2026-03-06 14:37:03 +01:00
Zef Hemel ff4c42a125 Grouping docs cleanup 2026-03-06 14:36:30 +01:00
Zef Hemel 82f1c9dd74 Cleaned up imports/exports 2026-03-06 14:36:23 +01:00
Zef HemelandGitHub 15cd08f190 Merge pull request #1873 from mjf/fix-lua-table-rendering
Fix table cell alignment for missing and misaligned cells
2026-03-06 14:35:21 +01:00
Matouš Jan Fialka 81f5ec7f67 Fix table cell alignment for missing and misaligned cells
The table style is determined by the header row. After normalizing the
header (filling empty cells between consecutive delimiters), extract
two properties: the column count and whether the header starts with
a delimiter.

For each data row, normalization proceeds in three steps. First, fill in
empty cells between consecutive delimiters (this handles empty cells in
the middle of a row). Second, if the header has no leading delimiter but
the row does, insert an empty cell after the row's leading delimiter (this
corrects the one-position shift caused by the row having a leading pipe
that the header lacks. Third, if the row has fewer cells than the header
column count, pad with empty cells at the end (this handles rows that
are shorter than the header because trailing pipes or cells were
omitted).

The same normalization is applied both in the renderer and the indexer.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 14:20:48 +01:00
Zef Hemel 947edf52c8 Remove redundant type argument 2026-03-06 13:59:37 +01:00
Zef Hemel 3859af0260 Remove redundant Deno global vars 2026-03-06 13:57:28 +01:00
Zef Hemel adfa5e5596 Bring autofocus back in auth 2026-03-06 13:53:57 +01:00
Zef Hemel 8a2424f27f Fix mini editor regressions 2026-03-06 13:50:29 +01:00
Zef Hemel d6424b714a Merge branch 'main' into to-node 2026-03-06 13:38:23 +01:00
Zef HemelandGitHub c75f48d8a3 Merge pull request #1819 from onespaceman/panels
Panels - strings to elements
2026-03-06 13:30:03 +01:00
Zef Hemel ad45eebba4 2.5.2 2026-03-06 13:20:22 +01:00
Zef HemelandGitHub 49f1b58dbb Merge pull request #1871 from mjf/fix-table-indexer-empty-cells
Fix table indexer empty cells - continued
2026-03-06 13:15:36 +01:00
Matouš Jan FialkaandGitHub b5fadf4dc2 Merge branch 'silverbulletmd:main' into fix-table-indexer-empty-cells 2026-03-06 08:58:08 +01:00
Matouš Jan Fialka 7c35c05367 Fix regression
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 08:52:54 +01:00
Matouš Jan Fialka 9b37060d9f Extract normalizer to helper shared by both parser and renderer
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 08:45:16 +01:00
Zef HemelandGitHub eaa85a990a Merge pull request #1870 from mjf/fix-table-indexer-empty-cells
Fix table indexer shifting columns when cells are empty
2026-03-06 08:37:09 +01:00
Zef Hemel 9db8d822f7 Fixes #1850 2026-03-06 08:31:53 +01:00
Zef Hemel 06e4a4c7ed Fixes #1869 2026-03-06 08:20:45 +01:00
Matouš Jan Fialka c4c0c64fb5 Fix table indexer shifting columns when cells are empty (final)
The Markdown parser omits `TableCell` nodes for empty cells, so
`collectNodesOfType` returns fewer cells than columns.

The indexer mapped cells to headers by array index, causing all cells
after an empty one to shift left.

The HTML renderer already solved this: its `TableRow` case walks the
children and injects empty `TableCell` nodes between consecutive
`TableDelimiter` nodes with no cell in between.

This patch extracts that same normalization logic into a reusable
`normalizeTableRow` helper and applies it to each row before collecting
cells.

The original index-based cell-to-header mapping then works correctly
without any positional arithmetic. I feel like this is more elegant
solution to the issue.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 08:16:26 +01:00
Zef Hemel dbf275d75b Introduce biome as linter with lint fixes 2026-03-06 08:05:13 +01:00
Matouš Jan Fialka 9e4f5f7bc6 Fix table indexer shifting columns when cells are empty
For example, with the following table:

```markdown
| a   | b   | c   |
| --- | --- | --- |
| 1   |     | 3   |
| 1   | 2   | 3   |
| a   | b   | c   |
| a   | b   |     |
|     | b   | c   |
| x   |     |     |
|     |     | z   |
```

the following query results in dataset with shifted columns
when cells are empty:

```lua
from
  index.tag 'table'
where
  page == 'test'
order by
  pos asc
select {
  a, b, c
}
```

This is now fixed and gives correct results:

|0 |1 |2 |
|--|--|--|
|1 |  |3 |
|1 |2 |3 |
|a |b |c |
|a |b |  |
|  |b |c |
|x |  |  |
|  |  |z |

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 07:56:21 +01:00
Dobli 30a1356db8 Set default state of toc to open 2026-03-05 23:31:59 +01:00
Dobli 7a3ff21419 Align new toc widget style with existing widgets 2026-03-05 22:22:24 +01:00
Zef Hemel de32dfb0f5 Auto discover lua test files 2026-03-05 16:39:19 +01:00
Zef Hemel 873fa7e4f5 Further simplification of runtime loading 2026-03-05 16:38:05 +01:00
Zef Hemel 9d39c8b1b8 Merge branch 'main' into to-node 2026-03-05 16:26:16 +01:00