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

Add CLI tool #32

Merged
merged 2 commits into from
Dec 1, 2021
Merged

Add CLI tool #32

merged 2 commits into from
Dec 1, 2021

Conversation

sgugger
Copy link
Contributor

@sgugger sgugger commented Nov 30, 2021

This PR adds some CLI tools with:

  • a function that converts an rst file to a mdx file (should be use to convert manually a doc file once we have full support for MDX with the new front).
  • a function that builds the doc (replaces the old script build_doc and makes it easier to launch it from anywhere.

@mishig25
Copy link
Contributor

mishig25 commented Dec 1, 2021

doc-builder/Makefile

Lines 7 to 8 in 84cc793

doc:
python src/build.py transformers ../transformers/docs/source/

needs to be updated

text = f.read()

page_info = {"package_name": package_name, "page": source_file.with_suffix(".html").relative_to(doc_folder)}
text = convert_rst_to_mdx(text, page_info, add_imports=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does convert_md_to_mdx has to be somewhere here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this is only for rst files (I can add a check).

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Cool, that's a nice API!

"Cannot determine a default for package_name as the file passed is not in a git directory. "
"Please pass along a package_name."
)
doc_folder = git_folder / "docs/source"
Copy link
Member

Choose a reason for hiding this comment

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

That's not robust for windows but I'm not sure we care in a v1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do two / which should be.

@sgugger sgugger merged commit 8408788 into main Dec 1, 2021
@sgugger sgugger deleted the cli_tools branch December 1, 2021 17:35
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.

None yet

3 participants