I think the issue is here
:
You have lang-auto class name applied with markdown code and automatically removed here so the library can guess the language.
However, when you go fullscreen, lang-auto is no longer in the element, and you have only language-<detected-language-here> class name here. Thus, lang is undefined.
A maybe fix could be here – if lang-auto is not found, look for language-<..>
const m = className.match(/^lang-(.+)$/);
→
const m = className.match(/^`(?:lang|language)-(.+)$/);