@@ -94,6 +94,7 @@ export function getCrossRefIndex(): Map<string, CrossRefTarget> {
9494 *
9595 * Handles:
9696 * - RST role syntax: :class:`ClassName`, :func:`function_name`, :meth:`method_name`
97+ * - Docutils literal code: ``ClassName`` (<tt class="docutils literal">)
9798 * - Plain backtick code: `ClassName`, `function_name`
9899 * - Title tag references from docutils: <cite>ClassName</cite>
99100 * - Single-quoted class names in text: 'ClassName'
@@ -132,7 +133,16 @@ export function processCrossRefs(
132133 return match ;
133134 } ) ;
134135
135- // 3. Handle inline code that matches known classes/functions
136+ // 3. Handle docutils literal inline code: <tt class="docutils literal">Name</tt>
137+ html = html . replace ( / < t t c l a s s = " d o c u t i l s l i t e r a l " > ( [ A - Z ] [ a - z A - Z 0 - 9 _ ] * ) < \/ t t > / g, ( match , name ) => {
138+ const target = index . get ( name ) ;
139+ if ( target && target . type === 'class' ) {
140+ return `<a href="${ fullPath ( target . path ) } " class="crossref crossref-${ target . type } ">${ name } </a>` ;
141+ }
142+ return match ;
143+ } ) ;
144+
145+ // 4. Handle inline code that matches known classes/functions
136146 // Be careful not to match code inside pre blocks or already-processed links
137147 html = html . replace ( / < c o d e > ( [ A - Z ] [ a - z A - Z 0 - 9 _ ] * ) < \/ c o d e > / g, ( match , name ) => {
138148 // Skip if it looks like it's already part of a link
@@ -143,7 +153,7 @@ export function processCrossRefs(
143153 return match ;
144154 } ) ;
145155
146- // 4 . Handle title attribute references (docutils)
156+ // 5 . Handle title attribute references (docutils)
147157 html = html . replace (
148158 / < s p a n c l a s s = " [ ^ " ] * " t i t l e = " ( [ ^ " ] + ) " > ( [ ^ < ] + ) < \/ s p a n > / g,
149159 ( match , title , text ) => {
@@ -155,7 +165,7 @@ export function processCrossRefs(
155165 }
156166 ) ;
157167
158- // 5 . Handle single-quoted class names in plain text: 'ClassName'
168+ // 6 . Handle single-quoted class names in plain text: 'ClassName'
159169 // Only match PascalCase names (likely class names)
160170 html = html . replace ( / ' ( [ A - Z ] [ a - z A - Z 0 - 9 _ ] * ) ' / g, ( match , name ) => {
161171 const target = index . get ( name ) ;
0 commit comments