Skip to content

Commit 2147018

Browse files
authored
[Fix] notebook_to_mdx command corerct output dir (#470)
1 parent 568fc4d commit 2147018

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc_builder/commands/notebook_to_mdx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ def notebook_to_mdx_command(args):
5858
src_path = Path(args.notebook_src).resolve()
5959
src_dir = src_path.parent if src_path.is_file() else src_path
6060
notebook_paths = [src_path] if src_path.is_file() else [*src_dir.glob("**/*.ipynb")]
61-
output_dir = src_dir if args.output_dir is None else Path(args.output_dir).resolve()
6261

6362
for notebook_path in tqdm(notebook_paths, desc="Converting .ipynb files to .md files"):
6463
notebook = nbformat.read(notebook_path, as_version=4)
6564
mdx_content = notebook_to_mdx(notebook, args.max_len)
6665
mdx_file_name = notebook_path.name[: -len(".ipynb")] + ".md"
66+
output_dir = notebook_path.parent if args.output_dir is None else Path(args.output_dir).resolve()
6767
dest_file_path = output_dir / mdx_file_name
6868
with open(dest_file_path, "w", encoding="utf-8") as f:
6969
f.write(mdx_content)

0 commit comments

Comments
 (0)