Skip to content

Commit

Permalink
Better spacing for codeblocks on docs (#8686)
Browse files Browse the repository at this point in the history
* styling for codeblocks

* add changeset

* formatting

* add changeset

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
  • Loading branch information
3 people authored Jul 3, 2024
1 parent 6cc69bc commit 64ac05b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/puny-bananas-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"website": patch
---

feat:Better spacing for codeblocks on docs
14 changes: 14 additions & 0 deletions js/_website/src/lib/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
}
code.language-python {
@apply !leading-7 !whitespace-pre-wrap !break-all;
line-height: 1 !important;
}
code.language-bash {
@apply !leading-7 !whitespace-pre-wrap !break-all;
Expand Down Expand Up @@ -249,10 +250,19 @@ li > ul {
padding-bottom: 0 !important;
}

code {
font-size: 0.9em;
}

pre > code {
font-weight: 500 !important;
border-radius: 0.25rem;
font-size: 0.9em !important;
line-height: 1 !important;
}

h3.header-tag {
margin-bottom: 10px;
}

h1 > code,
Expand Down Expand Up @@ -302,3 +312,7 @@ strong {
.embedded-component .gradio-container footer {
display: none !important;
}

.obj .codeblock {
@apply my-4;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ demo = gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="E
demo.launch()
```

**Custom Chatbot**: A `gr.ChatInterface` with a custom `gr.Chatbot` that includes a placeholder as well as upvote/downvote buttons. The upvote/downvote buttons are automatically added when a `.like()` event is attached to a `gr.Chatbot`.

In order to attach event listeners to your custom chatbot, wrap the `gr.Chatbot` as well as the `gr.ChatInterface` inside of a `gr.Blocks` like this:
**Custom Chatbot**: A `gr.ChatInterface` with a custom `gr.Chatbot` that includes a placeholder as well as upvote/downvote buttons. The upvote/downvote buttons are automatically added when a `.like()` event is attached to a `gr.Chatbot`. In order to attach event listeners to your custom chatbot, wrap the `gr.Chatbot` as well as the `gr.ChatInterface` inside of a `gr.Blocks` like this:

```py
import gradio as gr
Expand Down

0 comments on commit 64ac05b

Please sign in to comment.