Skip to content

Add "Ask a question" banner#301

Merged
mishig25 merged 2 commits into
mainfrom
add_question_banner
Aug 31, 2022
Merged

Add "Ask a question" banner#301
mishig25 merged 2 commits into
mainfrom
add_question_banner

Conversation

@mishig25

@mishig25 mishig25 commented Aug 23, 2022

Copy link
Copy Markdown
Contributor

Closes #248

For the demo, please check the doc link from the bot

Screenshot 2022-08-24 at 10 31 49

Screenshot 2022-08-24 at 10 31 42

For reference, script used to update all mdx files:

from pathlib import Path
import re
re_heading1 = re.compile(r"^(# .*)$", re.MULTILINE)
re_chapter = re.compile(r"chapter([0-9]+)")

p = Path("/Users/mishig/Desktop/course/chapters")
files = [x for x in p.glob("**/*") if x.is_file() and (str(x).endswith(".md") or str(x).endswith(".mdx"))]

for file in files:
    if not re_chapter.findall(str(file)):
        continue
    chapter = int(re_chapter.findall(str(file))[0])
    with open(file, "r", encoding="utf-8-sig") as reader:
        content = reader.read()
    if chapter == 0 or "DocNotebookDropdown" in content:
        continue
    svelte = f"""<CourseFloatingBanner
    chapter={{{chapter}}}
    classNames="absolute z-10 right-0 top-0"
/>"""
    content = re_heading1.sub(rf"\1\n\n{svelte}", content, 1)
    with open(file, "w", encoding="utf-8") as writer:
        writer.write(content)

@mishig25 mishig25 changed the title Add_question_banner Add "Ask a question" banner Aug 23, 2022
@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Aug 23, 2022

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@mishig25 mishig25 requested review from gary149 and lewtun August 24, 2022 08:34

@lewtun lewtun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @mishig25 and great idea to roll this out to all the translations too ❤️

I've checked the links for the English (and parts of the Spanish) content and this LGTM!

I'll wait for @gary149's approval before merging

@mishig25

Copy link
Copy Markdown
Contributor Author

btw, there is no forum link for Chapter 9

could you create one @abidlabs @lewtun ? it should be https://discuss.huggingface.co/t/chapter-9-questions

@lewtun

lewtun commented Aug 24, 2022

Copy link
Copy Markdown
Member

btw, there is no forum link for Chapter 9

could you create one @abidlabs @lewtun ? it should be https://discuss.huggingface.co/t/chapter-9-questions

Ah, I did that when I reviewed the PR - sorry I didn't mention that!

@mishig25 mishig25 merged commit dbe0c28 into main Aug 31, 2022
@mishig25 mishig25 deleted the add_question_banner branch August 31, 2022 13:04
@mishig25

Copy link
Copy Markdown
Contributor Author

Merging it for now 😊
If we encounter any problems, I'll revert it back

@mishig25

mishig25 commented Sep 1, 2022

Copy link
Copy Markdown
Contributor Author

@lewtun now that this PR is merged. Please feel free to make a release based on your convenience 👍

@lewtun

lewtun commented Sep 2, 2022

Copy link
Copy Markdown
Member

@lewtun now that this PR is merged. Please feel free to make a release based on your convenience 👍

Will do it today!

GITbaburin pushed a commit to GITbaburin/course that referenced this pull request May 17, 2026
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.

A button towards the forum

3 participants