-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Documentation conversion into Mkdocs #7609
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
base: live-docs
Are you sure you want to change the base?
Conversation
…ocs-conversion
- Import Jekyll material from graphic-library-docs repository. - Remove (most) mentions of languages other than Python and JavaScript. - Add Makefile to re-run commands.
… into mkdocs-conversion
…nto mkdocs-conversion
…the html snippets for each file under 'docs/tmp/'
…om the 'mkdocs.yml' file.
- Add `./Makefile` with commands to rebuild documentation using the
commands shown below. (We'll tidy this up in the final step.)
- `make examples`
- `make reference`
- `make build`
- Move scripts from `./docs/bin` to `./bin` and adjust paths in
scripts as needed to pick up the right files and to build into
`./tmp`.
- Modify `./mkdocs.yml` to build from `./tmp`.
- Modify `./.gitignore` to ignore `./tmp`.
Note that this is only a step toward the final cleaned-up version: the
next step is to move `./docs/_posts` into the root directory, then
remove `./docs` entirely and build the site into `./docs` rather than
into `./doc`.
refactor: move documentation generation into the root directory
- and remove last vestiges of Jekyll
…into mkdocs-conversion
…ow on banners and header
| Our JavaScript tutorials are written in HTML files in the `_posts/plotly_js` directory of this repository. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this accurate? I don't see that directory
| To quickly make a contribution to Plotly's JavaScript graphing libraries documentation, simply submit a pull request with the change you would like to suggest. This can be done using the GitHub graphical user interface at https://github.com/plotly/graphing-library-docs. | ||
|
|
||
| The easiest way to do this is to follow the `Edit this page on GitHub` link at the top right of the page you are interested in contributing to: | ||
|
|
||
|  | ||
|
|
||
| **You don't have to worry about breaking the site when you submit a pull request!** This is because your change will not be merged to production immediately. A Plotly team member will first perform a code review on your pull request in order to ensure that it definitely increases the health of Plotly's graphing libraries codebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This readme should be updated to have the new steps
docs/404.html
Outdated
| @@ -0,0 +1,4518 @@ | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is page used to generate what's in content and then that's used for what's in docs?
Is there a reason why we'd need to commit this generated content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, docs used to contain different content (unsure what exactly but it was related to the old build) and is now used to hold the site contents when you run mkdocs build. There is no reason to keep the generated content, it just hasn't been removed yet after the mkdocs changes, will remove it now!
| @@ -3452,7 +3444,7 @@ | |||
| "valType": "number" | |||
| }, | |||
| "maxheight": { | |||
| "description": "Sets the max height (in px) of the legend, or max height ratio (reference height * ratio) if less than or equal to 1. Default value is: 0.5 for horizontal legends; 1 for vertical legends. The minimum allowed height is 30px. For a ratio of 0.5, the legend will take up to 50% of the reference height before displaying a scrollbar. The reference height is the full layout height with the following exception: vertically oriented legends with a `yref` of `\"paper\", located to the side of the plot. In this case, the reference height is the plot height.", | |||
| "description": "Sets the max height (in px) of the legend, or max height ratio (reference height * ratio) if less than one. Default value is: 0.5 for horizontal legends; 1 for vertical legends. The minimum allowed height is 30px. For a ratio of 0.5, the legend will take up to 50% of the reference height before displaying a scrollbar. The reference height is the full layout height except for vertically oriented legends with a `yref` of `\"paper\"`, where the reference height is the plot height.", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these changes be here? I see some attributes are removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LiamConnors This branch probably needs to be updated with the latest changes from master
| [project] | ||
| name = "plotly.js" | ||
| description = "Plotly JavaScript charting library" | ||
| version = "3.1.0" | ||
| requires-python = ">=3.12" | ||
| dependencies = [ | ||
| "markdown", | ||
| "python-frontmatter", | ||
| "ruff" | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| dev_build = [ | ||
| "mkdocs", | ||
| "mkdocs-material", | ||
| "mkdocs-gen-files", | ||
| "mkdocs-literate-nav", | ||
| "markdown-include", | ||
| "mkdocs-macros-plugin", | ||
| "mkdocs-redirects", | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the breakdown of dependencies here suggests there are dependencies for Plotly.js. But is this pyproject.toml just for the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Liam that pyproject.toml is a confusing file to include here since Plotly.js is not a Python project. Could the dependencies be tracked in a requirements.txt file instead, inside a docs/ subdirectory maybe? We can discuss.
| # Manage plotly.js documentation. | ||
|
|
||
| RUN = uv run | ||
| SCHEMA_SRC = test/plot-schema.json | ||
| HANDWRITTEN = content | ||
| TMP = tmp | ||
|
|
||
| EXAMPLES_DIR = ${HANDWRITTEN}/plotly_js | ||
| EXAMPLES_IN := $(shell find "${EXAMPLES_DIR}" -name '*.html') | ||
| EXAMPLES_TMP = ${TMP}/javascript | ||
| EXAMPLES_OUT = ${EXAMPLES_TMP}/axes/index.html # could be any of the generated files | ||
|
|
||
| REFERENCE_DIR = ${HANDWRITTEN}/reference_pages/javascript/ | ||
| REFERENCE_IN := $(wildcard ${REFERENCE_DIR}/*.html) | ||
| REFERENCE_TMP = ${TMP}/reference | ||
| REFERENCE_OUT = ${REFERENCE_TMP}/bar/index.html # could be any of the generated files | ||
|
|
||
| DOCS_DIR=docs | ||
| DOCS_OUT=${DOCS_DIR}/sitemap.xml | ||
|
|
||
| ## commands: show available commands | ||
| commands: | ||
| @grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g' | column -t -s ':' | ||
|
|
||
| ## docs: rebuild full documentation in `./docs` | ||
| .PHONY: docs | ||
| docs: ${DOCS_OUT} | ||
|
|
||
| ${DOCS_OUT}: ${EXAMPLES_OUT} ${REFERENCE_OUT} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add to the docs contributing guide on how to build the docs, and maybe a GitHub action that runs the required steps to test generating the output.
|
General comment on file organization: I'd like to minimize the number of files added at the top level of this repo. Ideally anything related to the docs should be contained inside a |
.gitignore
Outdated
|
|
||
| tmp | ||
|
|
||
| docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A directory being added by this PR should not be in the .gitignore!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the directory just now since it was generated content and there is no need to commit it into the repo. I kept the .gitignore as is because mkdocs will generate its site there if you run mkdocs build.
Converted the plotly.js documentation build into Mkdocs
src/traces/image/attributes.jsfor proper Markdown rendering on plotly.py docs' function docstrings.code-highlight.cssapplies syntax highlighting. This is done because the markdown files are HTML snippets.plotly/plotly.js/README.mdand index pages are placed in each individual category of examples underOverview.