DB: text export expands a deprecated {{embed [[page]]}} macro into the page's content
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
The expansion happens in replace-block&page-embeds in frontend.handler.export.common-impl, and the three assertions to revisit are in frontend.handler.export-test (export-blocks-as-markdown-without-properties, export-blocks-as-markdown-newline-after-block, export-blocks-as-markdown-level<N>). Before changing code, a maintainer needs to decide whether DB graphs should keep expansion (B) or write the macro as text (A); the issue has no decision yet. If A is chosen, done means export and paste round-trip a block with an embed macro unchanged.
Written by the indexing model from the issue text.
Description
In a DB graph, a block whose text contains the file-graph embed macro, e.g.
Groceries {{embed [[Shopping]]}}
is shown as "Groceries" and the deprecated-macro warning (frontend.components.block, :block.macro/embed-deprecated); the Shopping page's blocks are not shown. DB embeds are :block/link blocks made with the embed command.
Exporting that block as text (Copy as / Export as Markdown) writes the Shopping page's blocks in place of the macro:
- Groceries
- milk
- eggs
So the export contains content the block does not show, and pasting the export back gives three blocks instead of the one block. If the embedded page is empty, the macro disappears from the export without a trace (- Groceries).
The expansion is done by replace-block&page-embeds in frontend.handler.export.common-impl (code from file graphs, where the macro did show the page). Three tests in frontend.handler.export-test assert it for the text export: export-blocks-as-markdown-without-properties, export-blocks-as-markdown-newline-after-block, export-blocks-as-markdown-level<N.
Which is intended for DB graphs?
- A. The text export writes the macro as text (
- Groceries {{embed [[Shopping]]}}), the way the block shows it; export and paste give back the same block. Those three tests change. - B. The text export keeps expanding the macro, as now.
Found by fuzzing export as text → paste. Happy to send the PR for A with tests.
- Dominant language
- No language data
- Stars
- 29
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from logseq/db-test
-
Web build on a phone: the fold arrow of an h1/h2 block lies on its bullet, so tapping the bullet folds instead of zooming inPossibly taken @tiensonqin claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Page titles with `$$`, `$&`, `` $` `` or `$'` change when block refs are resolvedPossibly taken @RaphaelFakhri claimed this 19 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
`#Asset` label is not displayed on asset nodes when `Hide from Node` is disabledPossibly taken @tiensonqin claimed this 22 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug sharing & sync
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
navikt/pensjonskalkulator-frontend-monorepo#270 ·
Maintainers usually reply within 1 day
-
reproduced
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
anomalyco/opencode#62873 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
inveniosoftware/invenio-app-rdm#3630 ·
Maintainers usually reply within 2 days