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

Desktop: Fixes #11617: Links from imported notes from OneNote were being wrongly rendered #11618

Merged

Conversation

pedr
Copy link
Collaborator

@pedr pedr commented Jan 9, 2025

Fixes #11617

Summary

Sometimes, when the first element of an Oultine (paragraph) is a link it will, be wrongly rendered as seen in the image bellow. It seems only to happen when the link is the first element, but I could not recreate the problem from scratch on a new note, so I'm using the content from the faulty note that I found.

In the end, I could not figure out why this was happening, but I created a fix that takes cases like this into account and properly renders links like they are supposed to:

Before / After fix

2025-01-08_20-46

image

Important

I think the best implementation to fix this problem would be rewrite how render_hyperlink works, it seems like to me that the proper why to implement this would be to render everything after the \u{fddf} character as a hyperlink until we find the last element or backtrack everything and apply the correct styles if turns out that the text doesn't belong to a link.

This seems like the proper solution, but it is also more work, so I went with the quick fix for now.

Testing

I added an automated test based on a faulty note that we found. I could not recreate the issue from scratch.

@pedr pedr added bug It's a bug import Related to importing files such as ENEX, JEX, etc. labels Jan 9, 2025
@pedr pedr changed the title Desktop: Fixes #11617: Links from imported notes from OneNote were being wrongly rendered Desktop: Resolves #11617: Links from imported notes from OneNote were being wrongly rendered Jan 9, 2025
@pedr pedr changed the title Desktop: Resolves #11617: Links from imported notes from OneNote were being wrongly rendered Desktop: Fixes #11617: Links from imported notes from OneNote were being wrongly rendered Jan 9, 2025
indices.remove(0);
styles.pop();
}

// Probably the best solution here would be to rewrite the render_hyperlink to take this
// case in account, backtracking if necessary, but this will do for now
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add issue number here

@laurent22 laurent22 merged commit 86e6445 into laurent22:dev Jan 9, 2025
7 checks passed
@pedr pedr deleted the fix-onenote-link-on-start-paragraph-broken branch January 13, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug import Related to importing files such as ENEX, JEX, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Links from notes imported from OneNote can be wrongly rendered when it is the first element of the paragraph
2 participants