Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API Documentation

Some sub documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Other Documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
site_name: "test/api"
site_description: "This is an api."
repo_url: https://github.com/backstage/mkdocs-monorepo-plugin
edit_uri: edit/master/__tests__/integration/fixtures/ok-include-path-edit-uri-nested/api/docs/

plugins:
- monorepo

nav:
- Home: index.md
- Other: other/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Top Level Project Documentation

Some higher level info about the project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Other Documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
site_name: "Example"
site_description: "Description Here"
repo_url: https://github.com/backstage/mkdocs-monorepo-plugin
edit_uri: edit/master/__tests__/integration/fixtures/ok-include-path-edit-uri-nested/docs/

plugins:
- monorepo

nav:
- Home: "index.md"
- Other: "other.md"
- API: "!include api/mkdocs.yml"
9 changes: 9 additions & 0 deletions __tests__/integration/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,15 @@ teardown() {
assertFileContains './site/test/other/other/index.html' 'href="https://github.com/backstage/mkdocs-monorepo-plugin/edit/master/__tests__/integration/fixtures/ok-include-path-edit-uri/api/docs/other/other.md"'
}

@test "sets edit url for nested included path pages" {
cd ${fixturesDir}/ok-include-path-edit-uri-nested
assertSuccessMkdocs build

assertFileContains './site/index.html' 'href="https://github.com/backstage/mkdocs-monorepo-plugin/edit/master/__tests__/integration/fixtures/ok-include-path-edit-uri-nested/docs/index.md"'
assertFileContains './site/test/api/index.html' 'href="https://github.com/backstage/mkdocs-monorepo-plugin/edit/master/__tests__/integration/fixtures/ok-include-path-edit-uri-nested/api/docs/index.md"'
assertFileContains './site/test/api/other/other/index.html' 'href="https://github.com/backstage/mkdocs-monorepo-plugin/edit/master/__tests__/integration/fixtures/ok-include-path-edit-uri-nested/api/docs/other/other.md"'
}

@test "sets edit url for included wildcard pages" {
cd ${fixturesDir}/ok-include-wildcard-edit-uri
assertSuccessMkdocs build
Expand Down
2 changes: 1 addition & 1 deletion mkdocs_monorepo_plugin/edit_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __get_page_docs_dir(self):
return path.relpath(abs_page_config_file_dir, abs_root_config_file_dir)

def __get_page_src_path(self):
alias = self.page.url.split('/')[0]
alias = self.__get_page_dir_alias()
path = self.page.file.src_path
return path.replace('{}/'.format(alias), '')

Expand Down