DB: two forms of quote break export/paste round-trip (quote block vs. text starting with "> ")

Open
#1,439 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
markdown
Domain
backend

Research direction

Start with wrap-parse-block in frontend.handler.db-based.editor, which decides whether a leading > stays plain text, and with quote-content in logseq.common.export.file, which writes quote blocks. First settle which of the two forms is intended, since the fix depends on that choice. Done means an export/paste round-trip returns identical blocks for both forms, with a test covering each.

Written by the indexing model from the issue text.

Description

Exporting blocks as text and pasting that text back should give the same blocks. With quotes it cannot: a DB graph has two different kinds of block that both display as a quote, the text export writes both the same way (> some text), so pasting the export back has to turn one into the other. Whatever paste does, one of the two does not come back as itself.

The two forms

  1. A quote block: made with the quote command. It has :logseq.property.node/display-type :quote, the tag #Quote (:logseq.class/Quote-block), and its text is stored without >.
  2. A plain block whose text starts with > : typing > some text in a block and leaving it keeps the text as is (wrap-parse-block does not convert it), with no display type and no tag. It still renders as a quote: the block's text is parsed as - <title>, and mldoc reads - > some text as an empty title followed by a Quote.

They look the same but are different blocks: only the first has the #Quote tag and the display type (what a query on the tag, or anything checking the display type, sees).

By contrast, typing # some text in a block is converted on save: the # is removed and :logseq.property/heading 1 is set. So a heading has one form, and export/paste round-trips it; a quote has two, and export/paste cannot.

Which is intended?

  • If > at the start of a block should make a quote block (like # makes a heading), saving should convert it; the two forms become one, and export/paste round-trips quotes.
  • If > some text is meant to stay text that renders as a quote, the two are different blocks, and the export has to write them differently. logseq/logseq#13721 does this by writing the plain form as \> some text (mldoc reads the backslash as an escape).

Checked on master: saving > quote keeps the title > quote with no display type (frontend.handler.db-based.editor/wrap-parse-block); quote-content in logseq.common.export.file writes a quote block as > lines; mldoc parses - > quote as an empty heading and a Quote.

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from logseq/db-test

All issues in logseq/db-test

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.