Of course, now that tree-sitter is embedded in the upcoming Emacs 29, expect even better support than polymode to emerge over time as you can dole out parcels of your buffer to different language parsers.
e.g this matches markdown code blocks (and also extracts the language from the start to select the mode to run)
(define-auto-innermode poly-markdown-fenced-code-innermode
:head-matcher (cons "^[ \t]*\\(```{?[[:alpha:]].*\n\\)" 1)
:tail-matcher (cons "^[ \t]*\\(```\\)[ \t]*$" 1)
:mode-matcher (cons "```[ \t]*{?\\(?:lang *= *\\)?\\([^ \t\n;=,}]+\\)" 1)
:head-mode 'host
:tail-mode 'host)
( via https://polymode.github.io/defining-polymodes/ )