-
Notifications
You must be signed in to change notification settings - Fork 233
feat: better component for prompts #2984
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
Open
honzajavorek
wants to merge
17
commits into
master
Choose a base branch
from
honzajavorek/prompt-component
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
607e107
remove unused import
honzajavorek d561ea6
drop the default prompt (unused anyway)
honzajavorek aecda0d
change default title and use it
honzajavorek a411208
the word 'coding' is not worth setting an explicit title
honzajavorek 0ec30af
change the default prompt title
honzajavorek 2fd09f6
make the two boxes appear as one when open
honzajavorek ce34901
add a new component for prompt example
honzajavorek 6e52a70
use the new component (just once for a test)
honzajavorek 716c140
make linters happy
honzajavorek 82c731b
fix for prompt not being present in llm.txt
honzajavorek a6faf2c
allow PromptButton not to be collapsed
honzajavorek 48f4be4
use blockquote inside the PromptButton, so that words wrap better tha…
honzajavorek 9c8668b
allow using PromptButton as a ```prompt, oh yeah baby
honzajavorek 04a46cd
nuke PromptExample
honzajavorek 62f52e5
support custom titles
honzajavorek b785a76
change the name of PromptButton to PromptBlock
honzajavorek df05ee8
use the new prompt component throughout the AI course
honzajavorek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,20 @@ | |
| margin-bottom: 0; | ||
| } | ||
|
|
||
| /* Flatten the shared edge so the toggle card and the revealed prompt read as one box */ | ||
| .prompt-card.open { | ||
| border-bottom: none; | ||
| border-bottom-left-radius: 0; | ||
| border-bottom-right-radius: 0; | ||
| } | ||
|
|
||
| .prompt-card.open::before { | ||
| border-bottom-left-radius: 0; | ||
| border-bottom-right-radius: 0; | ||
| } | ||
|
|
||
| /* Apply margin-bottom only when the next sibling is not a heading */ | ||
| .prompt-card:not(:has(+ h1, + h2, + h3, + h4, + h5, + h6)), | ||
| .prompt-card:not(.open):not(:has(+ h1, + h2, + h3, + h4, + h5, + h6)), | ||
| .full-prompt-container:not(:has(+ h1, + h2, + h3, + h4, + h5, + h6)) { | ||
| margin-bottom: var(--ifm-leading); | ||
| } | ||
|
|
@@ -158,23 +170,35 @@ html[data-theme='dark'] .toggle-button:hover { | |
| } | ||
|
|
||
| .full-prompt-container { | ||
| margin-top: 1.2rem; | ||
| display: none; | ||
| margin-top: 0; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .full-prompt-container.visible { | ||
| display: block; | ||
| } | ||
|
|
||
| .full-prompt-container .full-prompt { | ||
| margin-top: 0; | ||
| background: var(--ifm-background-color); | ||
| border: 1px solid var(--ifm-color-emphasis-200); | ||
| border-radius: 8px; | ||
| box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%); | ||
| border-top: none; | ||
| border-radius: 0 0 8px 8px; | ||
| box-shadow: none; | ||
| } | ||
|
|
||
| .full-prompt pre { | ||
| .full-prompt-blockquote.full-prompt-blockquote { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this feels hacky (battling CSS specificity?), maybe another reason why we should keep |
||
| background: var(--ifm-pre-background); | ||
| border: none; | ||
| border-radius: 4px; | ||
| box-shadow: none; | ||
| margin: 0; | ||
| padding: var(--ifm-pre-padding); | ||
| color: var(--ifm-color-content); | ||
| font-family: var(--ifm-font-family-monospace); | ||
| font-size: 1.3rem; | ||
| line-height: 1.5; | ||
| color: var(--ifm-color-content); | ||
| white-space: pre-wrap; | ||
| word-wrap: break-word; | ||
| } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please elaborate? It seems
<blockquote>is made into a single-line Markdown> quote.Not that I expect the LLMs to care much, but it's not much nicer to read for humans.
I'm not sure about the semantics either, W3C describes blockquote as a section that is quoted from another source (source).
preimo fits here better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My sentence is wrong and it conflates few things together. The readability boost should happen for a person reading the docs, because it now word-wraps, which, I think, is desired for prompts (unlike code).
I feel like blockquote is better semantics than code, because we quote some prose we invented or tried with LLMs, and it's not technically code. In the end, perhaps https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/samp would be the closest? 😅
But tbh, I don't have a strong opinion about this. I have a strong opinion that the text of the prompt should wrap for those who read it. But I don't care that much what HTML element implements it, if it's blockquote or pre+css.
Thanks for checking the llm.txt, I didn't notice that it's a single line now, that's not really nice.