By default, the generated file requires a web server (e.g., Live Server - a VS Code extension). To generate a diff that can be opened without a web server, use the `--no_lazy_toc` command.
@@ -284,3 +288,9 @@ The accepted parameters are the same as those explained in [section 2.2](#22--co
`./convert.bat --parameters [--arch amd64|arm64]`
Where `--parameters` are the same as those explained in [section 2.2](#22--conversion) and `--arch` is an optional parameter to specify the architecture of the Docker image to be built (default is `amd64`).
# 4. Debug
## 4.1 Show time reports
Using the `--time` parameter prints the duration of each operation; it is useful for debugging performance.
help="Optionally, print a timing report at the end of the conversion process, showing the time taken for each section of the process. This can be used to identify any bottlenecks in the conversion process and optimize them for better performance.",
)
parser.add_argument(
"--no-lazy-toc",
action="store_true",
help="Optionally, disable the lazy loading of the Table of Contents (ToC) in the generated HTML files when converting from Markdown to HTML. By default, the ToC is loaded lazily to improve performance, but this option forces the ToC to be cloned in all the HTML files.",
)
args=parser.parse_args()
@@ -117,6 +124,8 @@ GIT_CHECKOUT_NAME: str = (
TIMER_ENABLED:bool=bool(args.time)
NO_LAZY_TOC:bool=bool(args.no_lazy_toc)
ifIS_GIT_DIFFandIS_DIFF:
print("Warning: --diff-git cannot be used together with --diff.")
print("--diff-git overrides --diff. Continuing with --diff-git behavior.")
@@ -612,8 +621,10 @@ if SRC_TYPE == "html" and DEST_TYPE == "docx":
postprocess_docx(OUTPUT_DOC_PATH)
ifSRC_TYPE=="md"andDEST_TYPE=="html":
toc_filename="index.html"
toc_path=os.path.join(DEST,toc_filename)
witht.section("Post-process HTML files"):
postprocess_html(DEST)
postprocess_html(DEST,NO_LAZY_TOC)
witht.section("Apply diff to HTML files"):
ifIS_DIFF:
# default diff_source_dir is GENERATED_FILE/{FOLDER}-base/html
@@ -630,16 +641,64 @@ if SRC_TYPE == "md" and DEST_TYPE == "html":