Skip to content

Commit fa144c5

Browse files
authored
Fix build paths for nested files (#35)
1 parent c200ff8 commit fa144c5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/writer.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ mdext(f) = string(splitext(f)[1], ".md")
6161
This function takes the filename `file`, and returns a file path in the `mdfolder` directory which has the same tree as the `src` directory. This is used to ensure that the Markdown files are output in the correct location for Vitepress to find them.
6262
6363
"""
64-
function docpath(file, mdfolder)
65-
filename = mdext(file)
66-
path = splitpath(filename)
67-
return joinpath((path[1:end-1])..., mdfolder, path[end])
64+
function docpath(file, builddir, mdfolder)
65+
path = relpath(file, builddir)
66+
filename = mdext(path)
67+
return joinpath(builddir, mdfolder, filename)
6868
end
6969

7070
"""
@@ -108,7 +108,7 @@ function render(doc::Documenter.Document, settings::MarkdownVitepress=MarkdownVi
108108
# Iterate over the pages, render each page separately
109109
for (src, page) in doc.blueprint.pages
110110
# This is where you can operate on a per-page level.
111-
open(docpath(page.build, settings.md_output_path), "w") do io
111+
open(docpath(page.build, builddir, settings.md_output_path), "w") do io
112112
for node in page.mdast.children
113113
render(io, mime, node, page, doc)
114114
end

0 commit comments

Comments
 (0)