Skip to content

Fix language aliases skipped by highlight pre-check (e.g. py)#22

Merged
jph00 merged 1 commit into
mainfrom
py
Jul 22, 2026
Merged

Fix language aliases skipped by highlight pre-check (e.g. py)#22
jph00 merged 1 commit into
mainfrom
py

Conversation

@ncoop57

@ncoop57 ncoop57 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The _hl method gated highlighting on lang in languages(), which excluded valid aliases like py that the highlighter itself accepts. Removed the pre-check and catch
ValueError instead, so aliases highlight and unknown languages are left untouched as before.

Changes

  • python/mdhtml/export.py: drop languages import; attempt the highlight and catch ValueError for unknown langs rather than pre-filtering against languages()
  • tests/test_export.py: add test_hl_lang_alias covering both alias resolution (```py) and graceful skip for unknown languages (```nosuchlang)

Notes

Behavior change is strictly additive — aliases fastpylight accepts now highlight, unknown languages are skipped as before.

@ncoop57
ncoop57 marked this pull request as ready for review July 22, 2026 15:48
@ncoop57
ncoop57 requested a review from jph00 July 22, 2026 15:48
@jph00
jph00 merged commit 4e22a9b into main Jul 22, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants