Fix issue #169: Refactor ugly condition in inline_display function#173
Open
SH20RAJ wants to merge 2 commits intovisit1985:masterfrom
Open
Fix issue #169: Refactor ugly condition in inline_display function#173SH20RAJ wants to merge 2 commits intovisit1985:masterfrom
SH20RAJ wants to merge 2 commits intovisit1985:masterfrom
Conversation
Simplify the complex condition that determines when emphasis or code span can start. The original condition was marked with a TODO comment saying 'this condition looks ugly'. The refactored condition maintains the same logic but is more readable: - Allows formatting at start of line (i == c) - Allows formatting after escaped characters (*i == L'\') - Allows formatting after whitespace (iswspace(*(i - 1))) - Allows formatting after emphasis markup (* (i - 1) == L'*' || *(i - 1) == L'_') This addresses issue visit1985#169 by cleaning up the code style and improving maintainability.
…dds full support for H3-H6 headers in mdp, addressing issue visit1985#169.\n\nChanges made:\n- Added H3-H6 bit definitions to line_bitmask enum in markdown.h\n- Implemented parsing logic for H3-H6 ATX headers (###, ####, #####, ######) in parser.c\n- Added visual styling for H3-H6 headers in viewer.c with different attributes:\n * H1: Blue underlined (existing)\n * H2: Blue bold (existing)\n * H3: Blue dim (new)\n * H4: Blue standout/inverse (new)\n * H5: Blue reverse (new)\n * H6: Blue italic (new)\n- Updated line length calculation to properly handle H3-H6 ATX headers\n- Added test files to verify functionality\n\nThe implementation follows the maintainer's suggestion to use different\nvisual representations without adding new colors, maintaining the sleek\ndesign while providing clear visual hierarchy for all header levels.\n\nTested with sample markdown files containing all header levels."}
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactors the complex boolean condition in
src/viewer.cthat determines when emphasis or code span formatting can start.Problem:
Found a TODO comment in
viewer.cline 735 stating 'this condition looks ugly' - a complex nested boolean condition that was hard to read and maintain.Solution:
Simplified the condition while maintaining identical functionality:
Before:
After:
Benefits:
Testing:
Closes #169