import os from utils.log import logger def generate_ppt(markdown_source, output_name, chromium_path="./chrome_sandbox") -> None: # check for marp if os.system("npx -y @marp-team/marp-cli --version") != 0: logger.critical("Marp is not installed") raise Exception("Marp is not installed") # if user is root, then set CHROMIUM_PATH to chromium_path if os.getuid() == 0 and os.name == "posix": logger.info("Running as root, setting CHROME_PATH") os.environ["CHROME_PATH"] = chromium_path # check for markdown source if not os.path.exists(markdown_source): raise Exception("Markdown source does not exist") # generate ppt os.system(f"npx -y @marp-team/marp-cli {markdown_source} -o {output_name} --allow-local-files")