Markdown mirror: should it import back? (properties syntax, page tags and aliases)

Open
#1,440 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
18/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
markdown
Domain
tooling

Research direction

This is an open design question, so the first step is a maintainer decision between options 1A/1B and 2A/2B, not code. Read ADR 0016 and docs/logseq-markdown-syntax.md for the mirror's property format, then block-properties-content in logseq.common.export.file, which drops db-attribute-properties (:block/tags, :block/alias). Only after a choice is agreed would the importer in logseq.graph-parser and tests change.

Written by the indexing model from the issue text.

Description

Two questions about the Markdown mirror (ADR 0016) and Logseq's own Markdown importer, found by fuzzing the loop mirror → import as a file graph → compare blocks.

ADR 0016 says the mirror is for files that can be "read by external tools, backed up, indexed, or inspected outside Logseq", and also that it "is not a backup format with guaranteed import fidelity". The answers depend on where between those two the mirror should sit.

1. Should the importer read the mirror's property syntax?

The mirror writes properties as list items with * (ADR Markdown Content 5, docs/logseq-markdown-syntax.md):

- Ship it
  * deadline:: Jan 1st, 2024
  * rating:: 5

The file-graph importer (logseq.graph-parser) reads properties only in the file-graph form, deadline:: Jan 1st, 2024 without the * . With the * it reads a list item with text, so every property of every type (date, number, url, checkbox, choice, node, default) is lost on import, and the * key:: value text ends up in the block.

  • A. Teach the importer that * key:: value is a property, so a mirror imports with its properties.
  • B. Leave it: the mirror is a readable copy, not something to import back.

2. How should the mirror write page tags and aliases?

Today the mirror writes neither (block-properties-content in logseq.common.export.file drops db-attribute-properties, which holds :block/tags and :block/alias, and the mirror adds tag tokens only to block lines). So a page tagged Book with alias Dorian has no trace of either in its file. Two ways to write them:

  • A. * tags:: [[Book]] and * alias:: [[Dorian]], the mirror's own property syntax (imports only with 1A).
  • B. tags:: [[Book]] and alias:: [[Dorian]], the file-graph form, which the importer already reads.

Whichever you prefer, happy to send the PR 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

  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 DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.