pub fn detect_embedded_regions_in_tree(
network: &LinkNetwork,
document: LinkId,
text: &str,
language: &str,
policy: RegionDetectionPolicy,
) -> Vec<EmbeddedRegion>Expand description
Embedded regions a host document delimits, in source order.
The whole buffer of a txt document is one region, and for HTML and
Markdown hosts the regions are those their grammar CST (the host’s
Syntax links below document) delimits. Mirrors detectEmbeddedRegionsInTree in js/src/regions.js; document
is the host’s Document link in network.
- HTML: the
raw_textof ascript_elementin the language itstypeattribute names (JavaScript when absent), theraw_textof astyle_elementas CSS, and theattribute_valueof everystyleattribute as CSS. - Markdown: the
code_fence_contentof afenced_code_blockin the languagepolicyselects from its info-stringlanguageand content, everyhtml_blockas HTML, and every inlinehtml_tagas HTML, spanning from an opening tag to the matching closing tag among its siblings.