Add RTL text plugin support and responsive HTML export#159
Open
yharby wants to merge 2 commits intoeoda-dev:mainfrom
Open
Add RTL text plugin support and responsive HTML export#159yharby wants to merge 2 commits intoeoda-dev:mainfrom
yharby wants to merge 2 commits intoeoda-dev:mainfrom
Conversation
- Bundle mapbox-gl-rtl-text.js for offline RTL text rendering - Patch pywidget.js to expose maplibregl globally - Initialize RTL plugin automatically in to_html() - Make HTML export responsive (fullscreen by default) - Add RTL text example and test Closes eoda-dev#157, Closes eoda-dev#158
This was referenced Feb 1, 2026
Update ipywidget.js and pywidget.js bundles from maplibre-bindings with RTL text plugin support for all environments: - Jupyter notebooks (MapWidget) - Marimo notebooks - Shiny apps Features: - RTL plugin bundled for OFFLINE usage (no CDN dependency) - Lazy loading: plugin only activates when RTL text is encountered - Safe initialization with error handling - maplibregl exposed globally for compatibility Add test examples for Marimo and Shiny. Related: eoda-dev/maplibre-bindings#4
yharby
added a commit
to yharby/maplibre-bindings
that referenced
this pull request
Feb 1, 2026
Initialize maplibregl.setRTLTextPlugin() in both bundles: - ipywidget.js (for Jupyter/Marimo via anywidget) - pymaplibregl.js (for Shiny and standalone HTML) Changes: - Import maplibre-gl in pymaplibregl.js and expose globally - Bundle RTL plugin source for OFFLINE usage (no CDN dependency) - Create blob URL from bundled plugin source - Safe initialization with error handling The RTL plugin (~150KB) is now bundled directly, enabling: - Offline usage without internet connection - No external CDN dependencies - Consistent behavior across all environments Closes eoda-dev#4 Related: eoda-dev/py-maplibregl#157, eoda-dev/py-maplibregl#159
af645b5 to
7b8afdf
Compare
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.
Summary
This PR adds support for the MapLibre RTL text plugin to enable proper rendering of right-to-left languages (Arabic, Hebrew, etc.) and makes HTML export responsive by default.
Changes
RTL Text Plugin Support
mapbox-gl-rtl-text.jsfor offline RTL text renderingMap.to_html(),Map.save())MapWidget)Responsive HTML Export
<head>sectionstyleparameterFiles Changed
maplibre/_templates.py- RTL init + responsive HTML templatemaplibre/map.py- Load RTL plugin into_html()maplibre/srcjs/pywidget.js- Updated bundle with RTL supportmaplibre/srcjs/ipywidget.js- Updated bundle with RTL supportmaplibre/srcjs/mapbox-gl-rtl-text.js- Bundled RTL plugintests/test_map.py- Added RTL testexamples/rtl_text_example.py- Visual test for standalone HTMLexamples/rtl_test_marimo.py- Visual test for Marimoexamples/rtl_test_shiny.py- Visual test for ShinyRelated
Test Plan
uv run pytest- All tests pass