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): remove line break from end of code blocks #2371

Merged
merged 1 commit into from
Mar 7, 2020

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Mar 7, 2020

Motivation

Resolve #2352

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Suppose we have an indented code block:

```
      --chart string                                   A helm chart to deploy (e.g. ./chart or stable/mysql)

      --chart-repo string                              The helm chart repository url to use
      --chart-version string                           The helm chart version to use
      --component devspace list available-components   A predefined component to use (run devspace list available-components to see all available components)
      --context string
      --dockerfile string                              A dockerfile
  -h, --help                                           help for deployment
      --image string                                   A docker image to deploy (e.g. dscr.io/myuser/myrepo or dockeruser/repo:0.1 or mysql:latest)
      --manifests string                               The kubernetes manifests to deploy (glob pattern are allowed, comma separated, e.g. manifests/** or kube/pod.yaml)
```

Before this fix (the first line has no indent):

--chart string                                   A helm chart to deploy (e.g. ./chart or stable/mysql)
      --chart-repo string                              The helm chart repository url to use
      --chart-version string                           The helm chart version to use
      --component devspace list available-components   A predefined component to use (run devspace list available-components to see all available components)
      --context string
      --dockerfile string                              A dockerfile
  -h, --help                                           help for deployment
      --image string                                   A docker image to deploy (e.g. dscr.io/myuser/myrepo or dockeruser/repo:0.1 or mysql:latest)
      --manifests string                               The kubernetes manifests to deploy (glob pattern are allowed, comma separated, e.g. manifests/** or kube/pod.yaml)

After this fix (all indents is in place, as expected):

      --chart string                                   A helm chart to deploy (e.g. ./chart or stable/mysql)

      --chart-repo string                              The helm chart repository url to use
      --chart-version string                           The helm chart version to use
      --component devspace list available-components   A predefined component to use (run devspace list available-components to see all available components)
      --context string
      --dockerfile string                              A dockerfile
  -h, --help                                           help for deployment
      --image string                                   A docker image to deploy (e.g. dscr.io/myuser/myrepo or dockeruser/repo:0.1 or mysql:latest)
      --manifests string                               The kubernetes manifests to deploy (glob pattern are allowed, comma separated, e.g. manifests/** or kube/pod.yaml)

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 Mar 7, 2020
@lex111 lex111 requested a review from yangshun March 7, 2020 07:15
@lex111 lex111 requested a review from wgao19 as a code owner March 7, 2020 07:15
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 7, 2020
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit a4ce1b4

https://deploy-preview-2371--docusaurus-2.netlify.com

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

Can we use String.prototype.trimEnd() instead? It's much clearer than using Regex.

@lex111
Copy link
Contributor Author

lex111 commented Mar 7, 2020

@yangshun no, this will delete all line breaks, this is hardly what we want. We need to remove only one line break (which we produce).
I mean, if the user left line breaks in their own code blocks, then they needs it and we should not delete them.

@yangshun
Copy link
Contributor

yangshun commented Mar 7, 2020

Oh I see. Is it possible that we just don't add the last one instead of adding it somewhere and then removing it again?

I'll merge this.

@yangshun yangshun merged commit 6b75aaf into master Mar 7, 2020
@lex111 lex111 deleted the lex111/remove-code-blocks-line-breaks-end branch March 7, 2020 09:05
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] wrong indenting / trimmed spaces in first line of code blocks
4 participants