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

Fix hyperlinks in the FAQ notebook #304

Merged
merged 1 commit into from
Aug 10, 2023
Merged

Conversation

eendebakpt
Copy link
Contributor

@eendebakpt eendebakpt commented May 11, 2023

The hyperlinks in the contents section of the FAQ did not work properly. In this PR we update the hyperlinks. The formatting is a bit error prone (changing the title means you have to manually update the contents table), but I could not find a method to auto-generate the contents from within the notebook.

Python script to update the links

Updating the links can be done by replacing the headers with this script

import re

t="""
- [What is GST?](#what_is_gst)
- [What is pyGSTi?](#what_is_pygsti)
"""

for idx,ln in enumerate(t.split('\n')):
    section_title=re.findall('\[.*?\]', ln)
    if len(section_title)!=1:
        continue
    
    hyperlink='(#' + section_title[0][1:-1].replace(' ', '-') +')' 
    #print(f'{idx}: {s}')
    m=re.sub('\]\(.*\)',']'+ hyperlink, ln)
    print(m)

@coreyostrove

@sserita sserita merged commit f4048c6 into sandialabs:develop Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants