From 51a5a7f9f82eae45a7a362118239f18bb0ce4f4e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Dec 2020 14:13:14 +0100 Subject: re-enable highlightling for newer Sphinx --- _exts/typescriptdomain.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '_exts') diff --git a/_exts/typescriptdomain.py b/_exts/typescriptdomain.py index f9af1b01..0f08fffe 100644 --- a/_exts/typescriptdomain.py +++ b/_exts/typescriptdomain.py @@ -8,6 +8,8 @@ TypeScript domain. import re +from pathlib import Path + from docutils import nodes from typing import List, Optional, Iterable, Dict, Tuple from typing import cast @@ -516,6 +518,10 @@ class MyPygmentsBridge(PygmentsBridge): self.line = line self.path = self.builder.env.doc2path(docname) self.docname = docname + elif isinstance(location, Element): + self.line = location.line + self.path = location.source + self.docname = Path(location.source).stem return super().highlight_block(source, lang, opts, force, location, **kwargs) -- cgit v1.2.3