Repository navigation
Fix five small page bugs: raw HTML links, home page, title, metadata - #170
Merged
Merged
Conversation
- Relative `src` and `href` URLs in raw HTML are adjusted like Markdown links when they point to a file in docs_dir relative to the Markdown file, so an `<img>` in a `<figure>` works with use_directory_urls. A URL that already works from the built page is left as it is. - `page.is_homepage` is True for the root index.md also when `nav` puts it inside a section. - HTML comments above the first heading (license headers) no longer stop the heading from becoming the page title. - `Foo: Bar` underlined with `===` is a heading, not MultiMarkdown metadata. `---` below metadata keeps working as before. - YAML front matter is read when the file ends right after the closing `---`.
Custom elements such as <swagger-ui src="openapi.json"/> belong to a plugin that resolves the URL itself, so adjusting it broke mkdocs-swagger-ui-tag in the plugin compatibility check.
Contributor
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five small bugs that MkDocs NG 1.11.1 still has. Each one breaks a page in a way users notice, and none of the fixes changes a page that builds correctly today.
imgtag withsrc="img/a.png"inside afigureinsec/page.mdbroke withuse_directory_urls, because only Markdown links were adjusted. RelativesrcandhrefURLs in raw HTML are now adjusted the same way, but only when they point to a file indocs_dirrelative to the Markdown file and don't already work from the built page. So HTML that was hand-written for the built site (../../img/a.png) stays as it is. Only standard elements (a,img,video,source,iframeand a few more) are adjusted: custom elements such asswagger-uibelong to a plugin that resolves the URL itself (the compatibility check caught this for mkdocs-swagger-ui-tag). Code blocks and inline code are not touched. Lookups go throughget_file_from_path, so themkdocs serverender cache sees them.page.is_homepagein a section. It wasFalsefor the rootindex.mdwhennavput it inside a section, so themes didn't treat it as the home page.# Headingbelow it from becoming the page title. Only comments are skipped; other HTML before the heading still means there is no title from the content.Foo: Barunderlined with===. It was read as MultiMarkdown metadata, so the heading disappeared. Only===counts as a heading underline here;Title: Xfollowed by---keeps working as metadata plus a rule.---is the last line of the file, with no newline after it, was ignored.Checked: the MkDocs NG docs site and the Sumi docs site (both languages) build byte-for-byte the same before and after, except for the pages this PR edits.
Related Issue
Roadmap item 48 in #59.
Checklist
docs/about/release-notes.mdupdated (if applicable): under 1.11.2 (unreleased)