Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add a way to pass a custom browser if wanted. (#343)

Aathish Sivasubrahmanian353dfdc40307
diff --git a/scripts/make_and_open_docs.py b/scripts/make_and_open_docs.py
index a328abb0e..4822a5e8d 100644
--- a/scripts/make_and_open_docs.py
+++ b/scripts/make_and_open_docs.py
@@ -1,11 +1,13 @@
from pathlib import Path
import os
+import sys
import webbrowser
path_makefile = Path(__file__).parents[1] / "docs"
os.system(f"cd {path_makefile} && make html")
-website = path_makefile / "build" / "html" / "index.html"
-webbrowser.open_new_tab(f"{website}")
-#alternative to the upper line:
-# webbrowser.get('firefox').open_new_tab(f"{website}")
+website = "file://" + str(path_makefile / "build" / "html" / "index.html")
+try: # Allows you to pass a custom browser if you want.
+ webbrowser.get(sys.argv[1]).open_new_tab(f"{website}")
+except IndexError:
+ webbrowser.open_new_tab(f"{website}")