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

GO-4162 corrupted links in markdown import #1624

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AnastasiaShemyakinskaya
Copy link
Member

https://linear.app/anytype/issue/GO-4162/corrupted-links-in-markdown-import

The problem is that we don't handle cases, when block have more than one markdown besides links. For example link can be also bold or italic.

To fix it

  • I check if text block have more than one markdown
  • Then I go through all marks in text block and change the type of mark to page mention in case it is link to existing page or file.

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Copy link

github-actions bot commented Oct 1, 2024

Previous Coverage 48.4% of statements
New Coverage 48.5% of statements
Patch Coverage 67.3% of changed statements (37/55)

Coverage provided by https://github.com/seriousben/go-patch-cover-action

assert.Equal(t, model.BlockContentTextMark_Object, block.GetText().GetMarks().GetMarks()[1].Type)
})
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сonsider use @deff7's testutil.BuildStateFromAST

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see advantages in using it, because we need just to manipulate text block

@@ -89,3 +89,155 @@ func Test_processFiles(t *testing.T) {
assert.Len(t, fileBlocks, 0)
})
}

func Test_processTextBlock(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using real markdown test data here

testing small internal functions leads to fragile tests and don't cover the whole process of import

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

Successfully merging this pull request may close these issues.

3 participants