Skip to content

Enhance emoji handling and asset prefixing in Markdown rendering#1853

Merged
nmaguiar merged 11 commits into
masterfrom
t8
Jun 23, 2026
Merged

Enhance emoji handling and asset prefixing in Markdown rendering#1853
nmaguiar merged 11 commits into
masterfrom
t8

Conversation

@nmaguiar

Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements and bug fixes related to Unicode emoji and string width handling in tables, as well as enhancements to Markdown-to-HTML conversion and asset handling. The most significant changes are improved Unicode emoji width calculation, better Markdown asset management (especially for KaTeX and CSS/font resources), and more robust handling of relative URLs in HTML/CSS.

Unicode and Emoji Handling Improvements:

  • Enhanced the visibleLength function in js/openaf.js to more accurately handle Unicode emoji, variation selectors, keycap marks, tags, and wide characters, ensuring correct width calculation for complex emoji sequences and improving table alignment. [1] [2] [3] [4] [5]
  • Updated table header centering logic in printTable to use right-padding only, preventing misalignment with wide or emoji-containing headers.

Markdown and HTML Asset Handling:

  • Added automatic registration and normalization of KaTeX and font assets in Markdown rendering, ensuring required JS/CSS/font files are available and paths are correctly prefixed. [1] [2]
  • Improved Markdown extra asset handling by normalizing and prefixing resource URLs in parseMD2HTML, making sure all asset links are absolute and correctly resolved.

HTML/CSS URL Resolution:

  • Introduced functions to resolve relative URLs in CSS and inline them as data URLs or absolute paths, ensuring that stylesheets and font references work correctly even when inlined. [1] [2]

Other Fixes and Cleanups:

  • Removed the unused trim function from the $path JMESPath custom functions, simplifying the codebase.

nmaguiar added 11 commits June 8, 2026 15:56
Update jna-platform dependency version in pom.xml and replace the corresponding jar file.
- Add automatic URI prefixing for scripts, stylesheets, and CSS URLs in Markdown rendering
- Implement automatic registration of KaTeX assets and fonts when the KaTeX package is present
- Update genStaticVersion to correctly handle relative asset inlining (e.g., fonts in CSS)
- Add tests for prefix support in parseMD2HTML and static asset inlining
Add __visibleLengthIsEmojiWide to correctly identify emojis that should occupy two columns. Update __visibleLengthCodePointWidth to use this check and add tests for emoji-presentation symbols and table alignment.
Use java.lang.Character for emoji modifier and component detection to accurately calculate the visible length of emoji clusters and subdivision flags, fixing alignment issues in tables.
Updates the table rendering logic in js/openaf.js to align content to the left instead of centering it. Added a new test case to verify header and row alignment.
Update visibleLength in js/openaf.js to better handle emoji clusters, variation selectors, keycap marks, and tags. This ensures correct width calculation for complex emojis in terminal output. Added corresponding tests in autoTestAll.Format.js and autoTestAll.Format.yaml.
…racters

- Implement robust visible length detection in AFBase.java to handle emoji clusters, ZWJ sequences, and regional indicators
- Update js/openaf.js to left-align table content by removing centering logic
- Update related tests in autoTestAll.Format.js/yaml to verify these changes
… detection

- Remove merge conflict markers from js/openaf.js, tests/autoTestAll.Format.js, and tests/autoTestAll.Format.yaml
- Improve handling of emoji variation selectors (text vs emoji presentation)
- Update PrintTable emoji alignment tests to use index-based verification instead of exact string matching
- Add new tests for emoji presentation and subdivision flags
@nmaguiar nmaguiar self-assigned this Jun 23, 2026
@nmaguiar nmaguiar added the dependencies Pull requests that update a dependency file label Jun 23, 2026
@nmaguiar nmaguiar merged commit 3bb677b into master Jun 23, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Continuous Enhancement Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug dependencies Pull requests that update a dependency file enhancement

Projects

Development

Successfully merging this pull request may close these issues.

1 participant