Skip to content

Update docs outline generation#566

Merged
zsunberg merged 2 commits intomasterfrom
docs_update
Mar 22, 2025
Merged

Update docs outline generation#566
zsunberg merged 2 commits intomasterfrom
docs_update

Conversation

@dylan-asmar
Copy link
Copy Markdown
Member

@dylan-asmar dylan-asmar commented Feb 10, 2025

This addresses #565.

This maintains the structure as before where we have subsections for each part of then the outline. The current way @contents is structured, it only accepts a list (link to documentation) for the Pages variable. If you pass the same structure we generate for makedocs you get:

ERROR: LoadError: MethodError: Cannot convert an object of type Pair{String, Vector{String}} to an object of type String
The function convert exists, but no method is defined for this combination of argument types.

This version appends the outline to the bottom of index.md, generates the docs, and then restores the original index.md file.

With that being said...we don't have to maintain the layout as we currently have it.

@dylan-asmar
Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member

@zsunberg zsunberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing to a file like this seems a bit complex and hard to maintain. What if we just do something like this:

julia> page_order = ["A" => ["a1.md", "a2.md"],
                     "B" => ["b1.md"]]
2-element Vector{Pair{String, Vector{String}}}:
 "A" => ["a1.md", "a2.md"]
 "B" => ["b1.md"]

julia> contents_pages = reduce(vcat, map(last, page_order))
3-element Vector{String}:
 "a1.md"
 "a2.md"
 "b1.md"

Then we can use Pages = contents_pages in the index.md file I think.

@dylan-asmar
Copy link
Copy Markdown
Member Author

Yeah, that would work, we would just lose the grouping of pages. If we are ok with changing the layout, then we could do it this way. Writing the file was the only way I could think of doing it while maintaining the current layout.

@dylan-asmar
Copy link
Copy Markdown
Member Author

I'm not quite sure if many people even use the outline at the bottom of the page when a similar structure exists on the left sidebar. Perhaps we could just remove this section?

Here is a comparison of what it would look like keeping the groupings vs not.

Screenshot 2025-03-06 at 5 26 14 PM

@zsunberg
Copy link
Copy Markdown
Member

zsunberg commented Mar 7, 2025

True. I think the number one goal is to keep it easy to maintain. Let's either (1) keep the outline without the headers or (2) get rid of the outline

I lean slightly towards (1), but am totally good with (2) if you prefer

@dylan-asmar
Copy link
Copy Markdown
Member Author

I decided to go with option 1. The preview of the docs is updated.

@dylan-asmar
Copy link
Copy Markdown
Member Author

@zsunberg Are we good to merge?

@zsunberg
Copy link
Copy Markdown
Member

Awesome! Thank you!

@zsunberg zsunberg self-requested a review March 22, 2025 21:28
Copy link
Copy Markdown
Member

@zsunberg zsunberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - I am a bit surprised taht you can execute that complex julia code in the @contents block - it might have been better to put it in make.jl, but it seems to work. Hopefully it will keep working.

@zsunberg zsunberg merged commit 08069e8 into master Mar 22, 2025
@zsunberg zsunberg deleted the docs_update branch March 22, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make docs more maintainable by correctly automating sidebar and contents order

2 participants