-
Notifications
You must be signed in to change notification settings - Fork 36
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
DOP-1604: Allow code blocks to render with caption #299
Conversation
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.
The A/C for this ticket definitely could have been more clear, but the goal is to show the caption in LeafyGreen's "chrome window" text, if it's specified. But so far so good—lemme know if I can clarify anything for you!
src/components/Code.js
Outdated
font-weight: bold; | ||
`} | ||
> | ||
{caption} |
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.
Just flagging: once this is implemented, we'll probably need to use a ComponentFactory
here to render the caption.
src/components/Code.js
Outdated
@@ -40,7 +40,7 @@ const getLanguage = lang => { | |||
}; | |||
|
|||
const Code = ({ | |||
nodeData: { copyable, emphasize_lines: emphasizeLines, lang, linenos, value }, | |||
nodeData: { copyable, caption, emphasize_lines: emphasizeLines, lang = 'none', linenos, value }, |
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.
Did you encounter a bug without this default none
for lang
? I recently changed this component to handle that in getLanguage()
, so wondering if you're seeing something weird!
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.
Ah, my mistake! I accidentally left lang = 'none'
because of a merge conflict. I'll fix this
src/components/Code.js
Outdated
@@ -60,6 +60,17 @@ const Code = ({ | |||
margin: ${theme.size.default} 0; | |||
`} | |||
> | |||
{/* This implementation of caption should change with DOP-1639 */} | |||
{caption && ( |
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.
The ticket was definitely unclear about this, but we actually want to render the caption as the component's chromeTitle
, if it exists!
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.
Oh, gotcha. Will change
src/components/Code.js
Outdated
@@ -72,6 +83,7 @@ const Code = ({ | |||
highlightLines={emphasizeLines} | |||
language={getLanguage(lang)} | |||
showLineNumbers={linenos} | |||
showWindowChrome={true} |
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.
We only want this property to be true
if a caption is specified.
[DOP-1604]
[Realms Staging /android/mongodb]
This PR introduces the inclusion of captions to code blocks.
caption
options are handled as strings. Code blocks now useshowWindowChrome
.