@@ -35,8 +35,11 @@ private XmlComment(Compilation compilation, string xml)
3535 // Transform triple slash comment
3636 var doc = XDocument . Parse ( xml , LoadOptions . PreserveWhitespace | LoadOptions . SetLineInfo ) ;
3737
38- ResolveCrefLink ( compilation , doc , $ "//{ DocumentationCommentXmlNames . SeeAlsoElementName } [@cref]") ;
39- ResolveCrefLink ( compilation , doc , $ "//{ DocumentationCommentXmlNames . SeeElementName } [@cref]") ;
38+ ResolveCrefLink ( compilation , doc , DocumentationCommentXmlNames . SeeAlsoElementName ) ;
39+ ResolveCrefLink ( compilation , doc , DocumentationCommentXmlNames . SeeElementName ) ;
40+
41+ ResolveLangKeyword ( doc , DocumentationCommentXmlNames . SeeElementName ) ;
42+
4043 // Resolve <list> and <item> tags into bullets
4144 ResolveListTags ( doc ) ;
4245 // Resolve <code> tags into code blocks
@@ -171,18 +174,20 @@ private static void ResolveParaTags(XDocument document)
171174 /// </summary>
172175 /// <param name="compilation">The compilation to resolve type symbol declarations from.</param>
173176 /// <param name="node">The target node to process crefs in.</param>
174- /// <param name="nodeSelector ">The node type to process crefs for, can be `see` or `seealso`.</param>
175- private static void ResolveCrefLink ( Compilation compilation , XNode node , string nodeSelector )
177+ /// <param name="elementName ">The node type to process crefs for, can be `see` or `seealso`.</param>
178+ private static void ResolveCrefLink ( Compilation compilation , XNode node , string elementName )
176179 {
177- if ( node == null || string . IsNullOrEmpty ( nodeSelector ) )
180+ if ( node == null || string . IsNullOrEmpty ( elementName ) )
178181 {
179182 return ;
180183 }
181184
182- var nodes = node . XPathSelectElements ( nodeSelector + "[@cref]" ) . ToArray ( ) ;
185+ var attributeName = DocumentationCommentXmlNames . CrefAttributeName ;
186+
187+ var nodes = node . XPathSelectElements ( $ "//{ elementName } [@{ attributeName } ]") . ToArray ( ) ;
183188 foreach ( var item in nodes )
184189 {
185- var cref = item . Attribute ( DocumentationCommentXmlNames . CrefAttributeName ) . Value ;
190+ var cref = item . Attribute ( attributeName ) . Value ;
186191 if ( string . IsNullOrEmpty ( cref ) )
187192 {
188193 continue ;
@@ -197,6 +202,33 @@ private static void ResolveCrefLink(Compilation compilation, XNode node, string
197202 }
198203 }
199204
205+ /// <summary>
206+ /// Resolves the links in the XML documentation into type names.
207+ /// </summary>
208+ /// <param name="node">The target node to process crefs in.</param>
209+ /// <param name="elementName">The node type to process crefs for, can be `see` or `seealso`.</param>
210+ private static void ResolveLangKeyword ( XNode node , string elementName )
211+ {
212+ if ( node == null || string . IsNullOrEmpty ( elementName ) )
213+ {
214+ return ;
215+ }
216+
217+ var attributeName = DocumentationCommentXmlNames . LangwordAttributeName ;
218+
219+ var nodes = node . XPathSelectElements ( $ "//{ elementName } [@{ attributeName } ]") . ToArray ( ) ;
220+ foreach ( var item in nodes )
221+ {
222+ var langword = item . Attribute ( attributeName ) . Value ;
223+ if ( string . IsNullOrEmpty ( langword ) )
224+ {
225+ continue ;
226+ }
227+
228+ item . ReplaceWith ( new XText ( $ "`{ langword } `") ) ;
229+ }
230+ }
231+
200232 private static IEnumerable < string ? > GetMultipleExampleNodes ( XPathNavigator navigator , string selector )
201233 {
202234 var iterator = navigator . Select ( selector ) ;
0 commit comments