The bug is also present in Emacs 26. It looks like `mhtml--extend-font-lock-region' and `font-lock-extend-region-multiline' are squabbling about where to leave `font-lock-beg'. In this particular example, `mhtml--extend-font-lock-region' wants to leave `font-lock-beg' at 40 while `font-lock-extend-region-multiline' wants it at 39, resulting in an endless back and forth. CC-ing Tom in case he has some insight into how it should be fixed. -- Simen