protected URL transformURL(URL link, ReferenceContext references) {
		if (URISchemeType.FILE.isURL(link)) {
			File filename = FileSystem.convertURLToFile(link);
			if (Strings.isEmpty(filename.getName())) {
				// This is a link to the local document.
				final String anchor = transformURLAnchor(filename, link.getRef(), references);
				final URL url = FileSystemAddons.convertFileToURL(filename, true);
				if (!Strings.isEmpty(anchor)) {
					try {
						return new URL(url.toExternalForm() + "#" + anchor); //$NON-NLS-1$
					} catch (MalformedURLException e) {
						//
					}
				}
				return url;
			}
			// This is a link to another document.
			final String extension = FileSystem.extension(filename);
			if (isMarkdownFileExtension(extension)) {
				filename = FileSystem.replaceExtension(filename, ".html"); //$NON-NLS-1$
				final String anchor = transformURLAnchor(filename, link.getRef(), null);
				final URL url = FileSystemAddons.convertFileToURL(filename, true);
				if (!Strings.isEmpty(anchor)) {
					try {
						return new URL(url.toExternalForm() + "#" + anchor); //$NON-NLS-1$
					} catch (MalformedURLException e) {
						//
					}
				}
				return url;
			}
		}
		return null;
	}
protected URL transformURL ( URL link , ReferenceContext references ) { if ( URISchemeType . FILE . isURL ( link ) ) { File filename = FileSystem . convertURLToFile ( link ) ; if ( Strings . isEmpty ( filename . getName ( ) ) ) { final String anchor = transformURLAnchor ( filename , link . getRef ( ) , references ) ; final URL url = FileSystemAddons . convertFileToURL ( filename , true ) ; if ( ! Strings . isEmpty ( anchor ) ) { try { return new URL ( url . toExternalForm ( ) + "#" + anchor ) ; } catch ( MalformedURLException e ) { } } return url ; } final String extension = FileSystem . extension ( filename ) ; if ( isMarkdownFileExtension ( extension ) ) { filename = FileSystem . replaceExtension ( filename , ".html" ) ; final String anchor = transformURLAnchor ( filename , link . getRef ( ) , null ) ; final URL url = FileSystemAddons . convertFileToURL ( filename , true ) ; if ( ! Strings . isEmpty ( anchor ) ) { try { return new URL ( url . toExternalForm ( ) + "#" + anchor ) ; } catch ( MalformedURLException e ) { } } return url ; } } return null ; }
Transform an URL from Markdown format to HTML format.

<p>Usually, the file extension ".md" is replaced by ".html".

<p>This function replaces the anchor to the local reference with the correct one (modified by outline feature).

@param link the link to transform.
@param references the set of references from the local document.
@return the result of the transformation. {@code null} if the link should not changed.