logseq / logseq/logseq

Long code block in query results are rendered strangely

Open
#4,047 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

:type/enhancement editor:code query-table
Dominant language
Clojure
Stars
45k
Forks
2.8k
Avg merge
1d 22h
Merged PRs (30d)
105

Description

**Describe the bug**
Long code block in query results are rendered strangely.
There is one page with very long code block, I query a single line in that code block and toggle the `table view`, the query result intend to display all the code in one line.

**To Reproduce**
Steps to reproduce the behavior:
1. open some new page A.
2. add one long code block in A. (this code contains a piece of code like `foo_bar`)
3. open some new page B.
4. add `{{query foo_bar}}` in B
5. You can see a long code in fence right, then toggle `Table view`, this long code block from A will be collapsed into one line.

**Expected behavior**

If possible, every line in a "fenced code block" should be treated as one unit.

At least, the query should not return too many lines of one large code block.

This "code query" thing could be a great feature for promoting logseq, imho.

**Screenshots**

![image](https://user-images.githubusercontent.com/40034603/151032885-ff9eb68f-ce8a-4baa-b5dd-0e5cd900e36d.png)

![image](https://user-images.githubusercontent.com/40034603/151033049-c9835c46-c131-406f-b204-5c953e5ce7ee.png)

**Desktop (please complete the following information):**
- OS: Windows 10
- Browser - (using win10 desktop version)
- Version Logseq-win-x64-0.5.9

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the issue with two pages, a long fenced code block, a single-line query, and the Table view toggle. Trace the query-results rendering entry point from that reproduction; done means fenced code is grouped or displayed without collapsing the block into an excessive single-line result, with a regression test if the existing test structure supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.