Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for custom templating #758

Merged
merged 27 commits into from
Aug 16, 2022
Merged

Conversation

alanlomeli
Copy link
Member

Related to #754
FYI: @nojaf

alanlomeli and others added 6 commits August 3, 2022 09:01
Pass the input folder to the Generate render functions.
- Move creategroup implementation to Menu file
- Cleanup menu file
- After cleanup Still need to figure out how to convert LiterateDocMode llist type to
  our new type, maybe with a partial active pattern?
- WIP namespace implementation
Add function to create menuItem elemetns
TBD: items showing wrong data
docs/_menu_template.html Outdated Show resolved Hide resolved
- Merge upstream
- Implemented All namespaces item render from html template
- Add and modified reviewed files
- Add .Ds_Store to .gitignore (First mac contributor?)
FSharp.Formatting.sln Outdated Show resolved Hide resolved
- Implemented changes from last feedback
- Implemented namespaces custom templating for GenerateMarkdown.fs
- Some code cleanup
nojaf and others added 3 commits August 10, 2022 09:51
Regenerate files when templates are updated.
- Added docs for new features
- Replace blank spaces in function 'snakeCase' so HTML ids wont fail
@alanlomeli alanlomeli force-pushed the customize-menu-items branch from 2fa72cd to 1b13e58 Compare August 11, 2022 06:51
docs/styling.md Outdated Show resolved Hide resolved
docs/styling.md Show resolved Hide resolved
docs/styling.md Outdated Show resolved Hide resolved
docs/styling.md Outdated
## Customizing menu items by template

You can add advanced stylings to the sidebar generated menu items by creating a new template for it.
For adding a template via command line you can use the `--input` option or alternatively add them to the docs/ folder.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is slightly confusing. What you basically want to say is that the fsdocs will look for menu templates in the --input folders. This folder defaults to docs.
You are not really adding any template via the command line.

Also, make it clear that both templates need to exist before. Otherwise, it won't work.

docs/styling.md Outdated Show resolved Hide resolved

type MenuItem = { Link: string; Content: string }

let private snakeCase (v: string) =
Copy link
Collaborator

Choose a reason for hiding this comment

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

This still produces kinda funky identifiers.
Consider "End-user documentation" being transformed to "_end-userdocumentation".
I would trim the leading and trailing _ and replace spaces with - or _ instead.
And may even replace all _ to - or vice versa, so you don't have a mix.

Feel free to revisit this entire helper function if that makes more sense.

Copy link
Collaborator

@nojaf nojaf 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, @dsyme this is ready for review.

@alanlomeli alanlomeli marked this pull request as ready for review August 15, 2022 13:33
@dsyme
Copy link
Contributor

dsyme commented Aug 15, 2022

Could we have some tests added as well please? e.g. in https://github.com/fsprojects/FSharp.Formatting/blob/main/tests/FSharp.ApiDocs.Tests/ApiDocsTests.fs?

@dsyme
Copy link
Contributor

dsyme commented Aug 16, 2022

Great!

@dsyme dsyme merged commit d981c2e into fsprojects:main Aug 16, 2022
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.

3 participants