Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PageLinkParser

Parses Markdown text and replaces page link tags with hyperlinks to pages and page groups

Hierarchy

  • PageLinkParser

Index

Constructors

constructor

Properties

Private _currentPageTitle

_currentPageTitle: string

Private _currentPageUrl

_currentPageUrl: string

Private _invalidePageLinks

_invalidePageLinks: InvalidPageLink[]

Private _logger

_logger: Logger

Private _options

_options: PluginOptions

Private _pages

Methods

Private _getRelativeUrl

  • _getRelativeUrl(absoluteUrl: string, relativeTo: string): string
  • Converts the provided absolute URL to a URL relative to the current page's URL

    Parameters

    • absoluteUrl: string

      Absolute URL to convert to a relative URL

    • relativeTo: string

      URL to make the URL relative to

    Returns string

    The converted URL

Private _handlePageLink

  • _handlePageLink(match: string, leading: string, tagName: string, linkText: string): string
  • Handles the replacement of a page link tags

    If the tag points at a page group, the page groups first page will be used as the link target. If the tab points at a page section, the first page of the first group in the section will be used as the link target. If no page or page group is found for the provided title, then the tag will not be replaced.

    Parameters

    • match: string

      The entire matching page link tag

    • leading: string

      The text leading before the tag

    • tagName: string

      The type of tag that was used (i.e. @page or @pagelink)

    • linkText: string

      The text following the tag - this is used to find the page or page group by title

    Returns string

    The string to replace the tag with

listInvalidPageLinks

  • listInvalidPageLinks(): void

parsePageLinks

  • parsePageLinks(event: MarkdownEvent): void
  • Parses the Markdown text provided in the TypeDoc Markdown event, replacing page link tags with hyperlinks

    If the PluginOptions.enablePageLinks option is false, this method will not replace the page links.

    Parameters

    • event: MarkdownEvent

      TypeDoc Markdown event

    Returns void

setCurrentPage

  • setCurrentPage(event: PageEvent): void
  • Configures the parser with the page currently being rendered

    Parameters

    • event: PageEvent

      TypeDoc page event

    Returns void

Generated using TypeDoc