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

オープン
#1,439 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
活発
技術スタック
markdown
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
言語のデータがありません
スター
29
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

logseq/db-test のほかの issue

logseq/db-test の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。