Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customizable docs to build #28186

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Update preview links for mdoc files
hestonhoffman committed Mar 20, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c69d616c39cc44ef9ea312ce4d88ff03617ac580
9 changes: 8 additions & 1 deletion local/bin/py/preview_links.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@

pattern1 = re.compile('content/en/(.*?).md')
pattern2 = re.compile('content/en/glossary/terms/(.*?).md')
pattern3 = re.compile('content/en/(.*?).mdoc.md')

# Grab YAML frontmatter from markdown file
def grab_glossary_title(filename):
@@ -25,8 +26,14 @@ def grab_glossary_title(filename):
new_filename = 'glossary/#' + anchor
return new_filename

# Handle markdoc files
def grab_markdoc_title(filename):
return filename.replace('content/en/', '').replace('.mdoc.md', '')

def compile_filename(filename):
if pattern2.match(filename):
if pattern3.match(filename):
return grab_markdoc_title(filename)
elif pattern2.match(filename):
return grab_glossary_title(filename)
elif pattern1.match(filename):
filename = filename.replace('content/en/', '').replace('_index', '').replace('.md', '')