Skip to content

Commit

Permalink
Merge pull request #6 from OUXT-Polaris/feaure/disable_dashboard
Browse files Browse the repository at this point in the history
enable check SHOW_DASHBOARD environment value
  • Loading branch information
hakuturu583 authored Dec 3, 2024
2 parents 121d2cc + fa76bd3 commit 62c1fbd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion mkdocs_github_dashboard/mkdocs_github_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
from python_github.python_github import Github
import re
import pandas as pd
import os

def is_env_var_true(env_var_name: str) -> bool:
value = os.environ.get(env_var_name, "").strip().lower()
if value == "true":
return True
elif value == "false":
return False
return False

class MkDocsGithubDashboardPlugin(BasePlugin):
def on_page_markdown(self, markdown, **kwargs):
if not is_env_var_true("SHOW_DASHBOARD"):
return markdown
github = Github()
for m in re.finditer(r'@github_dashboard\(.+?\)', markdown, re.MULTILINE):
replace_target = m.group()
Expand Down Expand Up @@ -42,4 +53,4 @@ def on_page_markdown(self, markdown, **kwargs):
markdown = plugin.on_page_markdown(text)
print("")
print(markdown)
#plugin.on_page_markdown(text)
#plugin.on_page_markdown(text)

0 comments on commit 62c1fbd

Please sign in to comment.