File size: 619 Bytes
9150552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os

def generate_ppt(markdown_source, output_name, chromium_path="./chrome_sandbox") -> None:
    # check for marp
    if os.system("marp --version") != 0:
        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":
        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"marp {markdown_source} -o {output_name} --allow-local-files")