commit 51a5a7f9f82eae45a7a362118239f18bb0ce4f4e
parent 1c03dae120dc47a3652b7d18a7d51511d2bf383e
Author: Florian Dold <florian@dold.me>
Date: Mon, 14 Dec 2020 14:13:14 +0100
re-enable highlightling for newer Sphinx
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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)