<source lang="lua">
mHatnote._rellink_hatnote('This is a hatnote.', {extraclasses = 'boilerplate seealso', selfref = true})
</source>
<source lang="lua">
mHatnote._formatLinkformatLink(link, display)
</source>
;Examples:
: {{code|mHatnote._formatLinkformatLink('Lion')|lua}} → <nowiki>[[Lion]]</nowiki> → {{format hatnote link|Lion}}
: {{code|mHatnote._formatLinkformatLink('Lion#Etymology')|lua}} → <nowiki>[[Lion#Etymology|Lion § Etymology]]</nowiki> → {{format hatnote link|Lion#Etymology}}
: {{code|mHatnote._formatLinkformatLink('Category:Lions')|lua}} → <nowiki>[[:Category:Lions]]</nowiki> → {{format hatnote link|Category:Lions}}
: {{code|mHatnote._formatLinkformatLink('Lion#Etymology', 'Etymology of lion')|lua}} → <nowiki>[[Lion#Etymology|Etymology of lion]]</nowiki> → {{format hatnote link|Lion#Etymology|Etymology of lion}}
=== Format pages ===
<source lang="lua">
mHatnote._formatPagesformatPages(...)
</source>
Formats a list of pages using the [[#Format link|_formatLinkformatLink]] function, and returns the result as an array. For example, the code {{code|mHatnote._formatPagesformatPages('Lion', 'Category:Lions', 'Lion#Etymology')|lua}} would produce an array like {{code|{'[[Lion]]', '[[:Category:Lions]]', '[[Lion#Etymology|Lion § Etymology]]'}|lua}}.
=== Format page tables ===
<source lang="lua">
mHatnote._formatPageTablesformatPageTables(...)
</source>
Takes a list of page/display tables, formats them with the [[#Format link|_formatLinkformatLink]] function, and returns the result as an array. Each item in the list must be a table. The first value in the table is the link, and is required. The second value in the table is the display value, and is optional. For example, the code {{code|mHatnote._formatPagesformatPages({'Lion', 'the Lion article'}, {'Category:Lions'}, {'Lion#Etymology', 'the etymology of lion'})|lua}} would produce an array like {{code|{'[[Lion|the Lion article]]', '[[:Category:Lions]]', '[[Lion#Etymology|the etymology of lion]]'}|lua}}.
=== Find namespace id ===
<source lang="lua">
mHatnote._findNamespaceIdfindNamespaceId(link, removeColon)
</source>
;Examples:
: {{code|mHatnote._findNamespaceIdfindNamespaceId('Lion')|lua}} → 0
: {{code|mHatnote._findNamespaceIdfindNamespaceId('Category:Lions')|lua}} → 14
: {{code|mHatnote._findNamespaceIdfindNamespaceId(':Category:Lions')|lua}} → 14
: {{code|mHatnote._findNamespaceIdfindNamespaceId(':Category:Lions', false)|lua}} → 0 (the namespace is detected as ":Category", rather than "Category")
=== Make wikitext error ===
<source lang="lua">
mHatnote._makeWikitextErrormakeWikitextError(msg, demo)
</source>
Example:
:{{code|mHatnote._makeWikitextErrormakeWikitextError('an error has occurred')|lua}} → <strong class="error">Error: an error has occurred.</strong>
== Examples ==
|