doc: Support any link having a fragment except http(s) links for linking between headings
This commit is contained in:
parent
53a4f10253
commit
5fe5e22395
|
@ -36,10 +36,18 @@ For linking between headings, place an anchor where you want to link to, e.g.:
|
|||
|
||||
# <a id="heading"></a> Heading
|
||||
|
||||
Please note that anchors have to be unique across all your Markdown documentation files.
|
||||
|
||||
Now you can reference the anchor either in the same or **in another** Markdown documentation file, e.g.:
|
||||
|
||||
This is a link to [Heading](#heading).
|
||||
|
||||
Other tools support linking between headings by giving the filename plus the anchor to link to, e.g.:
|
||||
|
||||
This is a link to [About/Heading](1-about.md#heading.md)
|
||||
|
||||
This syntax is also supported in Icinga Web 2.
|
||||
|
||||
## <a id="images"></a> Including Images
|
||||
|
||||
Images must placed in the `img` directory beneath your module's `public` directory, e.g.:
|
||||
|
|
|
@ -232,7 +232,7 @@ class SectionRenderer extends Renderer
|
|||
$html
|
||||
);
|
||||
$content[] = preg_replace_callback(
|
||||
'/<a\s+(?P<attribs>[^>]*?\s+)?href="#(?P<fragment>[^"]+)"/',
|
||||
'/<a\s+(?P<attribs>[^>]*?\s+)?href="(?:(?!http:\/\/)[^#]*)#(?P<fragment>[^"]+)"/',
|
||||
array($callback, 'render'),
|
||||
$html
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue