Unfortunately, the only reliable way to create internal links
is to use relative links to other Markdown files. This does
match the way links on GitHub work, but makes it harder to
create these links.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Unfortunately, the only reliable way to create internal links
is to use relative links to other Markdown files. This does
match the way links on GitHub work, but makes it harder to
create these links.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Unfortunately, the only reliable way to create internal links
is to use relative links to other Markdown files. This does
match the way links on GitHub work, but makes it harder to
create these links.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Now that we no longer have a baseURL, we can simplify the generated
links to just contain the anchor. This also provents issues if the
visited page already has an anchor set.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The JavaScript "link fix" looks to be only needed for pages
where Markdown is included, and which contain relative links.
Now that we modified all local includes to use absolute links,
the only location where links are not properly generated, is
in the reference documentation.
If broken links are found elsewhere in the website, those links
are legitimately broken, and should be fixed in the markdown
source, not fixed-up afterwards.
This patch moves the javascript to the cli.md include, so that
the script is only run on the reference pages instead of on every
page.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The base href caused browsers to produce incorrect URLs for
anchor links on various pages, for example, pointing to:
https://docs-test.docker.com/engine/reference/#foreground
Instead of
https://docs-test.docker.com/engine/reference/run/#foreground
Also cleaning up and fixing the JavaScript workaround for links
in include-files;
- only fix up links in the main content, not in other parts
of the page
- don't fix up anchor links, absolute links, or links that don't
contain `.md`: for those we can assume they were generated
correctly, and if not, those are links that should be fixed in
the markdown source, not fixed afterwards.
- document the function for future readers.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- remove some stray empty lines
- put liquid code that was before the opening HTML inside a HTML
comment, to prevent IDE's from marking it as invalid HTML
- fix some indentation
- fix some minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
When generating HTML pages, Jekyll will generate a directory named after the name
of the Markdown file, and generate an index.html file inside that directory. For
example, for a markdown file named /foo/bar/mypage.md, Jekyll generates a HTML
file named /foo/bar/mypage/index.html.
This means that all links relative to mypage.md, and expect those links to be
relative to the /foo/bar/ directory, will actually end up being relative to
/foo/bar/mypage/.
Unfortunately, Jekyll / Liquid does not have a variable that holds the parent
directory of the _markdown_ file, so we have to generate it by taking `page.path`
(which holds the absolute path of the markdownfile), and remove the filename from
that path.
After generating that path, we prepend that path to URLs linking to related
commands (parent commands and child commands), as all reference files are in the
same path.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Removing this "check" because it made the template difficult to
read, and duilding the docs won't fail if these values are missing.
If a page is empty, it's probably fast to find why anyway.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- remove some redundant whitespace
- use "remove_first" instead of "replace", because the strings to
replace should only occur once.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
We cannot use relative links in includes, because:
- The jekyll-relative-links, is not called on includes, so
markdown-links are rendered as-is.
- These files are included in various locations on the website;
because of that, it's not possible to compose a relative link
to other Markdown files, so we're falling back to using absolute
URLs, relative to the root of the website.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The base command didn't have a description in the YAML file.
Instead of fixing that up in the template, this was fixed upstream.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>