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

Cleanup markdown styling #8311

Merged
merged 5 commits into from
May 20, 2024
Merged

Cleanup markdown styling #8311

merged 5 commits into from
May 20, 2024

Conversation

aliabid94
Copy link
Collaborator

@aliabid94 aliabid94 commented May 16, 2024

Couple issues wth markdown styling, also lots of repeated css across Chatbot.svelte, MarkdownCode.svelte, and typography.css. I put repeated css in typography.css, removed from other sources. Also fixed:

  • nested list indentation didn't work in gr.Markdown
  • Text in a list that was longer than a line caused a line break at the start of the line, fixed now.
  • chatbot list indentation was too great in gr.Chatbot
  • Margin for h1, and for last element not set correctly

BEFORE
Screenshot 2024-05-16 at 3 56 34 PM

AFTER
Screenshot 2024-05-16 at 3 56 55 PM

Demo for above:

import gradio as gr

def welcome(name):
    return f"Welcome to Gradio, {name}!"

with gr.Blocks() as demo:
    md =     """Absolutely, here are 10 tips for maintaining your health from [Harvard Health](https://www.health.harvard.edu/staying-healthy/10-tips-for-better-health):
- Eat a variety of foods including fruits, vegetables, lean proteins, whole grains, and healthy fats. Avoid excessive sugar, salt, and processed foods.
    - nested a
    - nested b
    - lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

- Aim for at least 150 minutes of moderate aerobic activity or 75 minutes of vigorous activity each week, along with strength training exercises twice a week.

# Table Example
| Header 1 | Header 2 |
|----------|----------|
| Data 1   | Data 2   |
| Data 3   | Data 4   |

- Get at least 7 hours of sleep each night and practice good sleep hygiene.

$$y = mx + b$$

and finally some code:

~~~python
def welcome(name):
    return f"Welcome to Gradio, {name}!"
~~~

    """
    with gr.Row():
        gr.Markdown(md)
        gr.Chatbot([[md, md]], height="100%")

if __name__ == "__main__":
    demo.launch()

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented May 16, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website building...
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/fd2f59d7e3dbc0554a5b75588a4bacaa4e830007/gradio-4.31.3-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@fd2f59d7e3dbc0554a5b75588a4bacaa4e830007#subdirectory=client/python"

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented May 16, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/chatbot minor
@gradio/markdown minor
@gradio/theme minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Cleanup markdown styling

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

This is awesome. Thanks you @aliabid94!!

@aliabid94 aliabid94 merged commit 35905c5 into main May 20, 2024
9 checks passed
@aliabid94 aliabid94 deleted the cleanup_md branch May 20, 2024 22:36
@pngwn pngwn mentioned this pull request May 20, 2024
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.

None yet

4 participants