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

gendoc #4969

Closed
wants to merge 1 commit into from
Closed

gendoc #4969

wants to merge 1 commit into from

Conversation

charlesseizilles
Copy link
Contributor

@charlesseizilles charlesseizilles commented Apr 11, 2024

This pull requests adds a plugin that generates a html static site for xmake's documentation.
The framework will build the site by iterating over the markdown files in xmake/plugins/gendoc/doc and converting them to html using a native module based on cmark.

Each .md file must begin with metadata. The metadata and everything before it will be discarded when rendering a page.
Every key must be unique as they are used to identify a page and create links to it from other pages. Keys may only contain alphanumerical and underscore (_) characters.
When editting a .md file, special values can be used to be replaced with generated content:

  • ${anchor:key} (example) is used to add an id attibute to the html tag so that links can redirect to it.
  • ${link:key} (example) is used to generate a link to an anchor that may be in another page. They can and should be used in code blocks too.

Each .md file should represent exactly one API. They are groupped by page which are defined in pages.lua.
Pages are groupped by category whose name is given by the title field.
For each page, the site route is generated by concatenating the site root, the locale (ie. en-us), and the page's path field.
docdir field is the path relative to xmake/plugins/gendoc/doc/LOCALE from which all direct .md files will be pulled to fill the page.
Markdown files are appended to a page by following the alphanumerical order. You can for example prefix a .md file with 0_ to force it being the first file appended to a page.

@charlesseizilles
Copy link
Contributor Author

charlesseizilles commented Apr 11, 2024

The page field should be removed from the .md metadata, as a page defined in pages.lua already knows its path and may forward it to the .md file.
Also, the page's name field is currently unused, as well as .md metadata's isapi.
isapi was added in case we need to implement a search feature, allowing to "hide" some .md files like introductions/prefaces, etc.

@charlesseizilles
Copy link
Contributor Author

The embedded prism.js may be too big, and can be reduced by selecting fewer languages

@waruqi
Copy link
Member

waruqi commented Apr 12, 2024

This plugin is too big, and it will contain a lot of documentation. It is currently only experimental. So It should be maintained in a separate repository rather than committed directly to xmake.

Please push it to here first.

https://github.com/xmake-io/xmake-gendoc

@waruqi
Copy link
Member

waruqi commented Apr 12, 2024

xmake-io/xmake-gendoc#1

@waruqi waruqi closed this Apr 12, 2024
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.

2 participants