Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch_content breaks Markdown structure when modifying heading sections #5

Open
7shi opened this issue Dec 2, 2024 · 3 comments
Open

Comments

@7shi
Copy link
Contributor

7shi commented Dec 2, 2024

When using patch_content with any operation (append, prepend, or replace) to modify a heading section, it doesn't add necessary line breaks, which breaks the Markdown structure.

Example:

When applying:

{
  operation: "append",
  target_type: "heading",
  target: "test1",
  content: "baz"
}

to:

# test1
foo
# test2
bar

Current output:

# test1
foo
baz# test2
bar

Expected output:

# test1
foo
baz
# test2
bar

The function should automatically handle line breaks to preserve Markdown formatting for all operations.

@7shi 7shi changed the title patch_content breaks Markdown structure when appending content to headings patch_content breaks Markdown structure when modifying heading sections Dec 2, 2024
@MarkusPfundstein
Copy link
Owner

We need to check what the API expects here and what is the behaviour of the API.

@7shi
Copy link
Contributor Author

7shi commented Dec 6, 2024

Yes, I agree. That's why I avoided creating a PR independently and raised this as an issue first.

@7shi
Copy link
Contributor Author

7shi commented Dec 6, 2024

For additional context:

While testing mcp-obsidian, some users suggested that direct access to the Vault via the MCP filesystem server would be sufficient, eliminating the need for a specialized solution. I thought the main advantage of mcp-obsidian might be limited to specific functionalities like partial page modifications (e.g., appending content to specific headings).

However, this patch_content has been unstable due to issues with both the REST API and MCP, as evidenced by my previous PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants