8000 "Copy" in code blocks inject double newlines · Issue #7170 · squidfunk/mkdocs-material · GitHub
[go: up one dir, main page]

Skip to content

"Copy" in code blocks inject double newlines #7170

@jippi

Description

@jippi

Context

I want to make it easier for folks to copy configuration examples from my documentation page, by using the copy feature.

Bug description

When clicking the copy icon in all code blcoks on my documentation site, I get extra blank newlines in between the content.

I initially thought it was due to Annotations in code blocks, but does not seem to be the case.

Manually "drag cursor over text and copy" works fine.

Related links

Reproduction

Click any copy icon from my related links section and see that you get double newlines

For example; the Generate labels via script code block:

Expected

label:
  # Generate list of labels via script
  - strategy: generate
    # With a description (optional)
    description: "Modified this service directory"
    # With the color $pink
    color: "$pink"
    # From this script, returning a list of labels
    script: >
      /* Generate a list of files changed in the MR inside pkg/service/ */
      merge_request.modified_files_list("pkg/service/")

      /* Remove the filename from the path
        pkg/service/example/file.go => pkg/service/example */
      | map({ filepath_dir(#) })

      /* Remove the prefix "pkg/" from the path
         pkg/service/example => service/example */
      | map({ trimPrefix(#, "pkg/") })

      /* Remove duplicate values from the output */
      | uniq()

Actual

label:

  # Generate list of labels via script

  - strategy: generate

    # With a description (optional)

    description: "Modified this service directory"

    # With the color $pink

    color: "$pink"

    # From this script, returning a list of labels

    script: >

      /* Generate a list of files changed in the MR inside pkg/service/ */

      merge_request.modified_files_list("pkg/service/")



      /* Remove the filename from the path

        pkg/service/example/file.go => pkg/service/example */

      | map({ filepath_dir(#) })



      /* Remove the prefix "pkg/" from the path

         pkg/service/example => service/example */

      | map({ trimPrefix(#, "pkg/") })



      /* Remove duplicate values from the output */

      | uniq()

Steps to reproduce

  1. Go to any page
  2. Click the copy icon
  3. Paste into any editor or window

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0