Convert the Markdown source file to HTML as per the config.
(self, config: MkDocsConfig, files: Files)
| 261 | return title |
| 262 | |
| 263 | def render(self, config: MkDocsConfig, files: Files) -> None: |
| 264 | """Convert the Markdown source file to HTML as per the config.""" |
| 265 | if self.markdown is None: |
| 266 | raise RuntimeError("`markdown` field hasn't been set (via `read_source`)") |
| 267 | |
| 268 | md = markdown.Markdown( |
| 269 | extensions=config['markdown_extensions'], |
| 270 | extension_configs=config['mdx_configs'] or {}, |
| 271 | ) |
| 272 | |
| 273 | raw_html_ext = _RawHTMLPreprocessor() |
| 274 | raw_html_ext._register(md) |
| 275 | |
| 276 | extract_anchors_ext = _ExtractAnchorsTreeprocessor(self.file, files, config) |
| 277 | extract_anchors_ext._register(md) |
| 278 | |
| 279 | relative_path_ext = _RelativePathTreeprocessor(self.file, files, config) |
| 280 | relative_path_ext._register(md) |
| 281 | |
| 282 | extract_title_ext = _ExtractTitleTreeprocessor() |
| 283 | extract_title_ext._register(md) |
| 284 | |
| 285 | self.content = md.convert(self.markdown) |
| 286 | self.toc = get_toc(getattr(md, 'toc_tokens', [])) |
| 287 | self._title_from_render = extract_title_ext.title |
| 288 | self.present_anchor_ids = ( |
| 289 | extract_anchors_ext.present_anchor_ids | raw_html_ext.present_anchor_ids |
| 290 | ) |
| 291 | if log.getEffectiveLevel() > logging.DEBUG: |
| 292 | self.links_to_anchors = relative_path_ext.links_to_anchors |
| 293 | |
| 294 | present_anchor_ids: set[str] | None = None |
| 295 | """Anchor IDs that this page contains (can be linked to in this page).""" |