-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: remove new lines from the end of contextual text blocks #28
fix: remove new lines from the end of contextual text blocks #28
Conversation
Thank you.
So I thought about either making this helper more universal, or merging it (if I/we could find an elegant way) with the existing one that works with indentation: src/methods/aggregateDetails.ts#L51. That's why the issue is still here 😄 |
Thank you for sharing, I wasn't aware that other cases existed! I'm thinking it might be better to keep these helper functions modular so we can easily test them, however it may become cumbersome to call multiple functions nested within each other. We could have a 'parent' helper function that takes in an array of helper functions and the text as parameters and loops through the helper functions array, invoking the helper function with the outputted result from previous returned text each time. I'll have a think about it. It would be helpful if we could write some tests so we can better understand the edge cases we are attempting to solve. |
Are these trailing spaces, newlines and tabs appearing only at the end of the highlighted text block (contextualText) or do they appear in other places too? e.g. in between highlighted paragraphs |
No blame at all! I should have created an issue for that. UPD: Created #30 Let's continue this discussion there and place this PR on hold for some time.
Yes, that's how I thought initially. Modularity is a good approach both from coding and testing perspective, but eventually makes the code base a bit noisy since you end up having several helper functions doing relatively similar actions. Plus, wrapping text fragments into more than two helpers may worsen code readability.
Yeah, that's one of the possible ways.
Yes, TDD definitely makes sense. |
5f627f2
to
e5b071a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates.
I left one comment regarding tests, please check it.
Also, please make sure to do rebase of all your commits into one.
Thank you.
* remove unused field from db query response * make highlight consistent with rest of content * update test to use the proper highlight template
4c073ec
to
dcdce55
Compare
@bandantonio I've rebased this branch with master and squashed the commits down to one commit. I force-pushed the branch so the branch's commit history on GitHub is consistent with my local branch's commit history. I think you'll need to fetch this branch again as it's history has been re-written and will be different to your local branch. Apologies for the inconvenience. Please let me know if these changes resolve all the suggestions you made. Thanks |
0ed9ccc
to
56d3a0c
Compare
Summary
Fixes #30
contextualText
text blocksThis removes newline characters which may exist at the end of
contextualText
text blocks which are creating unnecessary new lines in Obsidian's editing mode.This screenshot illustrates the bug in
contextualText
text blocks using the default template:This is after the fix is applied: