fix: mirror the Contents page to markdown by tiensonqin · Pull Request #13165 · logseq/logseq · GitHub
Skip to content

fix: mirror the Contents page to markdown - #13165

Open
tiensonqin wants to merge 2 commits into
masterfrom
logseq/mirror-contents-page-f031
Open

fix: mirror the Contents page to markdown#13165
tiensonqin wants to merge 2 commits into
masterfrom
logseq/mirror-contents-page-f031

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1144

Root cause

mirrorable-page? excluded every page with :logseq.property/built-in? true. The Contents page is seeded as a built-in page (alongside Library and Quick add) but holds ordinary user blocks. That made <mirror-page! return {:status :skipped :reason :excluded-page} and omitted Contents from full regeneration, so user content never reached mirror/markdown/pages/Contents.md.

Change

Keep excluding built-in, hidden, property, and user-email pages. Allow the Contents page by :block/name ("contents"). deleted-page? and page-job already use the same predicate, so Contents stays a write/update job instead of a delete on later txs.

Tests

  • Contents is mirrored to pages/Contents.md even when built-in? is true
  • Library, Quick add, Recycle, hidden user pages, and property pages still skip with :excluded-page
  • Full regeneration writes Contents and still omits Library / Quick add / built-in / property pages
  • Editing Contents updates the mirror without deleting it
  • An unrelated page tx does not delete a pre-existing Contents mirror

bb lint:dev passed. frontend.worker.markdown-mirror-test passed: 48 tests, 98 assertions, 0 failures.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 3, 2026 16:21
Exclude built-in pages from markdown mirroring except Contents, which is a user-facing page that holds ordinary blocks.

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
@tiensonqin
tiensonqin marked this pull request as ready for review September 3, 2026 16:27
Copilot AI lite review requested due to automatic review settings September 3, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped to the exclusion predicate and is backed by targeted tests that confirm Contents is mirrored while other excluded page types remain skipped.

Pull request overview

This PR fixes Markdown mirroring so the built-in Contents page (which can contain normal user blocks) is no longer excluded from mirroring, ensuring it is generated/updated as mirror/markdown/pages/Contents.md during both per-page updates and full regeneration.

Changes:

  • Allow the Contents page through the mirrorable-page? predicate even when ldb/built-in? is true (by matching :block/name "contents").
  • Extend markdown mirror tests to assert Contents is written while other built-in/hidden/property pages remain excluded, and that edits don’t trigger unintended deletes.
File summaries
File Description
src/main/frontend/worker/markdown_mirror.cljs Adjusts mirrorable-page? to permit the built-in Contents page to be mirrored.
src/test/frontend/worker/markdown_mirror_test.cljs Adds/extends tests covering Contents mirroring behavior and ensuring other excluded pages remain skipped.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Contents page is not generated as a Markdown mirror.

3 participants