anyproto / anyproto/anytype-api

[Bug] Markdown nested list indentation is stripped on update_object write

Open
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
113
Forks
20
Avg merge
16m
Merged PRs (30d)
1

Description

Have you read a contributing guide?
  • I have read CONTRIBUTING.md
  • I have searched the existing issues and didn't find any that were similar
  • I have considered creating a pull request with fixes instead of a bug report and want to proceed
Current Behavior

Leading spaces before nested - [ ] items are stripped. The list is flattened:

## Tasks
- [ ] Parent task A
- [ ] Subtask A1
- [ ] Subtask A2
- [ ] Parent task B
- [ ] Subtask B1
- [ ] Subtask B2
  - [ ] Deep subtask B2a   ← only survived because it uses U+2007 figure spaces
- [ ] Parent task C
- [ ] Subtask C1
Expected Behavior

The Tasks section should preserve its nested structure exactly as written.

Steps To Reproduce
  1. Read an object that contains nested markdown checkboxes:
## Tasks
- [ ] Parent task A
  - [ ] Subtask A1
  - [ ] Subtask A2
- [ ] Parent task B
  - [ ] Subtask B1
  - [ ] Subtask B2
    - [ ] Deep subtask B2a
- [ ] Parent task C
  - [ ] Subtask C1
  1. Update the same object via PUT /v1/spaces/{spaceId}/objects/{objectId} with the same markdown body (only changing a different section, e.g. an Evening note at the bottom).

  2. Read the object back.

  3. Leading spaces before nested - [ ] items are stripped. The list is flattened:

Environment
- Anytype Desktop: 0.47.x (latest stable)
- API version: 2025-11-08
- Client: @anyproto/anytype-mcp v1.2.9 (but reproducible directly via REST)
Anything else?
  • The get_object endpoint does return correct indentation on read (it uses figure spaces U+2007 for nesting in its output).
  • However, writing standard markdown spaces ( - [ ]) back through the API causes them to be lost during parsing.
  • This makes it impossible to do "surgical" updates to journal/daily-note objects where only the bottom section changes — the whole body must be rewritten, and that rewrite destroys the top-level Tasks hierarchy.
  • Workaround: manually using non-standard whitespace (figure spaces) before nested items, but this is not practical for users writing standard markdown.

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 through PUT /v1/spaces/{spaceId}/objects/{objectId}, using the nested Markdown checkbox body and then reading the object back. Trace the write-side Markdown parsing and compare it with the get_object output; done means standard-space indentation survives an update and the nested Tasks hierarchy remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.