logseq / logseq/db-test

Publish - Broken HTML Output

Open
#759 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug can't reproduce
Dominant language
No language data
Stars
28
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### Search first

- [x] I searched and no similar issues were found

### What Happened?

When publishing a Logseq database-based graph, the generated HTML file contains malformed JavaScript that causes the published page to be blank in browsers.

### Reproduce the Bug

1. Use Logseq DB version 2102
2. Create some pages with content and set publish all pages
3. Use Logseq UI to publish (Export → Export Public Pages)
4. Open the exported index.html file in a browser
5. The page is blank and shows no content

### Expected Behavior

The published HTML should display all pages and render correctly in the browser.

### Files

Use my database to publish and push to https://github.com/zhangxueshan246/zhangxueshan246.github.io .
The page is blank and shows SQLiteDB error: Error: Cannot read properties of undefined (reading '$DB$')

### Browser, Desktop or Mobile Platform Information

- Logseq version: from https://github.com/logseq/logseq/actions/runs/21748527923
- Graph type: Database
- Published site: https://github.com/zhangxueshan246/zhangxueshan246.github.io
- Browser: Chrome on Win 11

### Additional Context

AI said:
- Looking at the HTML source, the `window.logseq_db` variable is malformed:
- Expected: `window.logseq_db="[logseq_DB,{...}]"`
- Actual: `window.logseq_db="[logseq____"~#datascript/DBlogseq____",[logseq____"^ logseq____",logseq____"~:schemalogseq____"...`

The quotes are being mangled - `"` appears as literal text `logseq____"` in the output.

The serialization of the database to HTML is corrupting the quote characters. This needs to be fixed in the Logseq publish code for the DB version

### Are you willing to submit a PR? If you know how to fix the bug.

- [ ] I'm willing to submit a PR (Thank you!)

Contributor guide

No contributing guide indexed for this repository

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 export through Logseq UI using a database graph, then inspect the generated index.html and the window.logseq_db value. Compare the malformed quoted serialization with the expected database representation and verify that the published page renders all content in Chrome without the SQLiteDB error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
databases, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.