File tree 2 files changed +22
-3
lines changed 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -384,9 +384,12 @@ inlineToTypst inline =
384
384
case res of
385
385
Left il -> inlineToTypst il
386
386
Right r ->
387
- case mathType of
388
- InlineMath -> return $ " $" <> literal r <> " $"
389
- DisplayMath -> return $ " $ " <> literal r <> " $"
387
+ (case extractLabel str of -- #10805
388
+ Nothing -> id
389
+ Just lab -> (<> (" <" <> literal lab <> " >" ))) <$>
390
+ case mathType of
391
+ InlineMath -> return $ " $" <> literal r <> " $"
392
+ DisplayMath -> return $ " $ " <> literal r <> " $"
390
393
Code (_,cls,_) code -> return $
391
394
case cls of
392
395
(lang: _) -> " #raw(lang:" <> doubleQuoted lang <>
@@ -605,3 +608,10 @@ doubleQuoted = doubleQuotes . literal . escape
605
608
606
609
endCode :: Doc Text
607
610
endCode = beforeNonBlank " ;"
611
+
612
+ extractLabel :: Text -> Maybe Text
613
+ extractLabel = go . T. unpack
614
+ where
615
+ go [] = Nothing
616
+ go (' \\ ' : ' l' : ' a' : ' b' : ' e' : ' l' : ' {' : xs) = Just (T. pack (takeWhile (/= ' }' ) xs))
617
+ go (_: xs) = go xs
Original file line number Diff line number Diff line change
1
+ ```
2
+ % pandoc -t typst -f latex
3
+ \begin{equation}
4
+ \label{eq:U}
5
+ U = A
6
+ \end{equation}
7
+ ^D
8
+ $ U = A $<eq:U>
9
+ ```
You can’t perform that action at this time.
0 commit comments