feat(converter): add lang attribute to HTML output for accessibility#85
Merged
feat(converter): add lang attribute to HTML output for accessibility#85
Conversation
- Add DocumentLanguage setting to override document language - Add lang attribute to <html> element (auto-detected from document) - Update GetLangAttribute() to use actual document default language - Language detected from w:themeFontLang, default style, or fallback to "en-US" - Foreign text spans get lang attribute when different from doc default - Add WASM/npm support for documentLanguage option - Add 4 new tests for language attribute functionality Addresses converter gaps #10 (Document Language Attribute) and #11 (Foreign Text Spans)
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
langattribute to<html>element for improved accessibility (screen readers, browser hyphenation)langattribute to foreign text spans when language differs from document defaultDocumentLanguagesetting to manually override document languageChanges
Core Implementation:
DocumentLanguagesetting added toWmlToHtmlConverterSettingsandHtmlConverterSettingsGetDocumentDefaultLanguage()helper extracts language from document settingsw:themeFontLang→ default paragraph style → "en-US" fallbackGetLangAttribute()now uses actual document default instead of hardcoded "en-US"Full Stack:
documentLanguageparameter toConvertDocxToHtmlComplete()documentLanguage?: stringtoConversionOptionsinterfaceTests:
<html>getslangfrom themeFontLangDocumentLanguagesetting overrides documentHtmlConverterSettings.DocumentLanguageworksTest plan
Addresses converter gaps #10 and #11 from
docs/architecture/wml_to_html_converter_gaps.md