-
Notifications
You must be signed in to change notification settings - Fork 250
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
[SuperEditorMarkdown] Add header alignments #1350
Merged
matthew-carroll
merged 10 commits into
superlistapp:main
from
lamnhan066:header-alignment
Sep 29, 2023
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4ee2d83
Header alignments markdown serializer
lamnhan066 c3a8370
Header alignments markdown parser
lamnhan066 f0ddf9f
Header alignments markdown tests
lamnhan066 b89ff9a
Add justify alignment to the _alignmentNotationPattern
lamnhan066 7194a93
Update the HeaderNodeSerializer header comment
lamnhan066 a86786d
Make the condition clearer
lamnhan066 9d6a974
Add tests for parsing a header with alignment, also updating the 'exa…
lamnhan066 b35e29c
Format the code and improve the comments
lamnhan066 0bb0998
Update comments
lamnhan066 fca7d49
Update a comment
lamnhan066 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This comment is in a strange location. It's unclear how it relates to the code. After reading this comment, I go down a few lines, and we're adding the alignment token, so it's confusing to see a comment that says "there is no need to add the alignment token". Please ensure that comments appear in places that clarify code behavior, rather than confuse it.
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.
In the next line, we have
textAlign != 'left'
condition, which means we don't need to add the left alignment token to the markdown when we serialize a header node (the same as ParagraphNodeSerializer). Do you have any better comment for it?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.
The primary issue is the location of the comment. The code directly below that comment doesn't implement "no need to add the alignment token". This comment actually refers to a non-existent
else
statement.The code that actually exists is code that adds an alignment token. Not code that avoids adding an alignment token.
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.
I think it would be clear if the comment is "Left alignment is the default, so there is no need to add the left alignment token.".
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.
You're still phrasing the comment in terms of what the code ISN'T doing, instead of what the code IS doing. Please write code comments in terms of what the code IS doing.
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.
This comment has been updated as you requested.