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

fix(v2): add support for interleaving Markdown in code blocks #3749

Merged
merged 2 commits into from
Nov 16, 2020

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Nov 14, 2020

Motivation

Fixes #3746

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Try to put the following MDX snippet into the document and make sure it renders correctly.

import CodeBlock from '@theme/CodeBlock';

| Markdown | Less      | Pretty     |
| -------- | --------- | ---------- |
| _Still_  | `renders` | **nicely** |
| 1        | 2         | <CodeBlock>sum(rate(grpc_client_msg_received_total{component="tsbd", grpc_type="server_stream"}[30s])) by (cluster_name)</CodeBlock>|

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: bug fix This PR fixes a bug in a past release. label Nov 14, 2020
@lex111 lex111 requested a review from slorber as a code owner November 14, 2020 08:15
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 14, 2020
@netlify
Copy link

netlify bot commented Nov 14, 2020

Deploy preview for docusaurus-2 ready!

Built with commit 5ad20d6

https://deploy-preview-3749--docusaurus-2.netlify.app

Comment on lines 116 to 118
if (typeof children !== 'string') {
children = (children as string[]).join('');
}
Copy link

@dio dio Nov 14, 2020

Choose a reason for hiding this comment

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

Awesome!

Yeah, I have a fork of CodeBlock as a @site level component doing this. What do you think of having Array.isArray checking instead (since we'll do joining)?

if (Array.isArray(children))

And should we introduce a new local var? Not sure about the style for rewriting args.

Copy link
Collaborator

@slorber slorber Nov 16, 2020

Choose a reason for hiding this comment

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

Agree that I'd rather have an isArray check here, but in practice it probably does not change much

@github-actions
Copy link

github-actions bot commented Nov 16, 2020

Size Change: +24 B (0%)

Total Size: 152 kB

ℹ️ View Unchanged
Filename Size Change
website/build/blog/2017/12/14/introducing-docusaurus/index.html 20.7 kB +1 B
website/build/docs/introduction/index.html 180 B 0 B
website/build/index.html 5.84 kB +1 B
website/build/main.********.js 108 kB +22 B (0%)
website/build/styles.********.css 17.4 kB 0 B

compressed-size-action

@lex111 lex111 force-pushed the lex111/interleaved-code-block branch 3 times, most recently from e299007 to 5ad20d6 Compare November 16, 2020 21:53
@lex111
Copy link
Contributor Author

lex111 commented Nov 16, 2020

Probably good for merging.

@lex111 lex111 merged commit 1dac7e3 into master Nov 16, 2020
@lex111 lex111 deleted the lex111/interleaved-code-block branch November 17, 2020 15:01
@lex111 lex111 added this to the v2.0.0-alpha.67 milestone Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v2, classic]: Rendering CodeBlock inside a table fails with a specific content/children
4 participants