-
-
Notifications
You must be signed in to change notification settings - Fork 32
Handle variations of Font size attribute values #15
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
base: develop
Are you sure you want to change the base?
Conversation
|
@K-Kumar-01 can you list out the tasks of the items still remaining as part of this PR and what will be in separate ones |
5041cfb to
b1a957e
Compare
Code Review CommentsIssues Found:
Suggestions:Consider refactoring to use the map and early returns for clarity. |
nicolasiscoding
left a comment
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.
See Claude AI Generated feedback
PR Review for #15: Handle variations of Font size attribute values (Updated)Overall Assessment: ✅ OUTSTANDINGThis is an exceptionally well-implemented PR that addresses CSS font-size keyword support with excellent code organization, comprehensive documentation, and smart optimizations. The latest updates have addressed all previous feedback and elevated the code quality significantly. PR SummaryProblem: HTML containing CSS font-size keywords (like Solution: Added comprehensive support for CSS font-size keywords with proper constants, documentation, and fallback handling. Key Improvements Made✅ Enhanced DocumentationAdded comprehensive JSDoc comments: /**
* CSS absolute font-size keyword mappings to pixel values
* Based on CSS specification: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
*/
const absoluteFontSizes = { ... }
/**
* Scaling factors for relative font-size keywords
* - smaller: 5/6 of parent font size
* - larger: 1.2x of parent font size
*/
const relativeFontSizeFactors = { ... }✅ Code OptimizationSmart Array-Based Check: // Before: Multiple if-else statements
if (fontSizeString === 'smaller') { ... }
else if (fontSizeString === 'larger') { ... }
// After: Elegant array-based check with object lookup
if (["smaller", "larger"].includes(fontSizeString)) {
return Math.floor(relativeFontSizeFactors[fontSizeString] * docxDocumentInstance.fontSize);
}✅ Code Formatting Improvements
Technical ExcellenceArchitecture Quality
Performance Optimizations
Error Handling
Code Quality Metrics
Implementation DetailsConstants Module (
|
Signed-off-by: Kushal Kumar <[email protected]>
Signed-off-by: Kushal Kumar <[email protected]>
for absolute font sizes for relative font size multipliers Signed-off-by: Kushal <[email protected]>
Signed-off-by: Kushal <[email protected]>
Signed-off-by: Kushal <[email protected]>
e7ed489 to
352ebde
Compare
|
@K-Kumar-01 I am adding test cases into the docx output to test for this, this is missing them and then will merge |
- Add tests for all 8 absolute size keywords (xx-small to xxx-large) - Add tests for relative size keywords (smaller, larger) - Add tests for nested relative keywords - Add tests for mixed units and keywords - Add edge case tests for invalid/empty values - Document limitation with relative keywords not using parent context 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Follow-up ActionsI've added the test cases to Next Steps
The current test cases in |
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.
Bug with font inheritance. This may fall into some of the items @Srajan-Sanjay-Saxena is testing in his PR (#111). Please plan accordingly


Fixes #122
This PR adds support for CSS font-size keyword values that were previously unsupported.
Changes
xx-smallthroughxxx-large) to pixel equivalentssmaller,larger) based on document default font sizefixupFontSizefunctionTesting
Manually verified pixel mappings against browser behavior for consistency.
Resolves the issue where HTML containing CSS font-size keywords would not be properly converted to DOCX format.