File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,16 @@ test('extractAnchors: code in headings', (t) => {
175175 t . deepEqual ( extractAnchors ( '# My `heading`' ) , [ '#my-heading' ] )
176176} )
177177
178+ test ( 'extractAnchors: math in headings' , ( t ) => {
179+ t . deepEqual ( extractAnchors ( '## Gates $\\rightarrow$ quantum gates' ) , [ '#gates-rightarrow-quantum-gates' ] )
180+ t . deepEqual (
181+ extractAnchors (
182+ '### Template circuits for calculating matrix elements of $\\tilde{S}$ and $\\tilde{H}$ via Hadamard test' ,
183+ ) ,
184+ [ '#template-circuits-for-calculating-matrix-elements-of-tildes-and-tildeh-via-hadamard-test' ] ,
185+ )
186+ } )
187+
178188test ( 'extractAnchors: mdx in headings' , ( t ) => {
179189 t . deepEqual ( extractAnchors ( '# My <B>heading</B>`' ) , [ '#my-heading' ] )
180190} )
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ pub fn get_text<'a>(node: &'a Node, s: &mut String) {
6363 let maybe_text = match node {
6464 Node :: Text ( text) => Some ( & text. value ) ,
6565 Node :: InlineCode ( text) => Some ( & text. value ) ,
66+ Node :: InlineMath ( text) => Some ( & text. value ) ,
6667 _ => None ,
6768 } ;
6869 if let Some ( text) = maybe_text {
@@ -95,6 +96,8 @@ fn heading_to_anchor(heading: String) -> String {
9596 ')' => None ,
9697 '"' => None ,
9798 '\'' => None ,
99+ '{' => None ,
100+ '}' => None ,
98101 x => Some ( x) ,
99102 } )
100103 . collect ( )
You can’t perform that action at this time.
0 commit comments