@@ -145,7 +145,7 @@ export class YamlGenerator {
145145
146146 const tocItem : IYamlTocItem = {
147147 name : RenderingHelpers . getUnscopedPackageName ( docItem . name ) ,
148- href : this . _getRelativeUrlForDocItem ( docItem , this . _outputFolder )
148+ uid : this . _getUid ( docItem )
149149 } ;
150150
151151 tocItems . push ( tocItem ) ;
@@ -301,46 +301,13 @@ export class YamlGenerator {
301301 // Eventually we should introduce a warnings file
302302 console . error ( '==> UNRESOLVED REFERENCE: ' + JSON . stringify ( args . reference ) ) ;
303303 } else {
304- // We will calculate a relativeUrl to the nearest non-embedded DocItem.
305- // (The rest will be determined by the URL fragment.)
306- let nonEmbeddedDocItem : DocItem = result . docItem ;
307- while ( this . _shouldEmbed ( nonEmbeddedDocItem . kind ) && nonEmbeddedDocItem . parent ) {
308- nonEmbeddedDocItem = nonEmbeddedDocItem . parent ;
309- }
310-
311- const currentFolder : string = path . dirname ( this . _getYamlFilePath ( containingDocItem ) ) ;
312- const relativeUrl : string = this . _getRelativeUrlForDocItem ( nonEmbeddedDocItem , currentFolder ) ;
313-
314- // Do we need to link to a fragment within the page?
315- if ( nonEmbeddedDocItem !== result . docItem ) {
316- const urlFragment : string = this . _getEmbeddedUrlFragment ( result . docItem ) ;
317- args . prefix = '[' ;
318- args . suffix = `](${ relativeUrl } #${ urlFragment } )` ;
319- } else {
320- args . prefix = '[' ;
321- args . suffix = `](${ relativeUrl } )` ;
322- }
323-
304+ args . prefix = '[' ;
305+ args . suffix = `](xref:${ this . _getUid ( result . docItem ) } )` ;
324306 }
325307 }
326308 } ) ;
327309 }
328310
329- // Returns a relative URL such as "../package/MyClass"
330- private _getRelativeUrlForDocItem ( docItem : DocItem , currentFolder : string ) : string {
331- const targetFilePath : string = this . _getYamlFilePath ( docItem ) ;
332- const relativePath : string = path . relative ( currentFolder , targetFilePath ) ;
333- let relativeUrl : string = relativePath
334- . replace ( / [ \\ ] / g, '/' ) // replace all backslashes with slashes
335- . replace ( / \. [ ^ \. \\ / ] + $ / , '' ) ; // remove file extension
336-
337- if ( relativeUrl . substr ( 0 , 1 ) !== '.' ) {
338- // If the path doesn't already start with "./", then add this prefix.
339- relativeUrl = './' + relativeUrl ;
340- }
341- return relativeUrl ;
342- }
343-
344311 private _writeYamlFile ( dataObject : { } , filePath : string , yamlMimeType : string ,
345312 schema : JsonSchema | undefined ) : void {
346313
@@ -384,15 +351,6 @@ export class YamlGenerator {
384351 return result ;
385352 }
386353
387- /**
388- * Calculate the HTML anchor fragment for DocItems that are embedded in a web page containing
389- * other items.
390- * Example: node_core_library_JsonFile_load
391- */
392- private _getEmbeddedUrlFragment ( docItem : DocItem ) : string {
393- return this . _getUid ( docItem ) . replace ( / \. / g, '_' ) ; // replace all periods with underscores
394- }
395-
396354 private _getYamlFilePath ( docItem : DocItem ) : string {
397355 let result : string = '' ;
398356
0 commit comments