Skip to content

prettier-plugin-sh formats console output blocks #415

Closed

Description

@reteps

Blocks of code like this:

CONTAINER ID  IMAGE                      COMMAND              CREATED      STATUS      PORTS                   NAMES
e0f522f41ea4  prairielearn/prairielearn  "/bin/sh -c /Prai…"  2 hours ago  Up 2 hours  0.0.0.0:3000->3000/tcp  upbeat_roentgen

Marked with console type get formatted in my markdown files. This comes from https://github.com/github-linguist/linguist/blob/c27ac0c1daf3865e2b45ee3908d06b5825161d17/lib/linguist/languages.yml#L6926-L6937.

Since a ShellSession isn't valid input for formatting, I would expect these blocks to be ignored.

Activity

  1. JounQin commented on Mar 28, 2025

    @JounQin
    Member

    As you linked

    https://github.com/github-linguist/linguist/blob/c27ac0c1daf3865e2b45ee3908d06b5825161d17/lib/linguist/languages.yml#L6926-L6937

    ShellSession's ace_mode is sh, so that's expected.

    Maybe you should use log or other language tag instead.

    Or <!-- prettier-ignore --> for that block.

  2. JounQin commented on Mar 28, 2025

    @JounQin
    Member
    ```console
    $ ls
    bla bla bla
    ```
    
    $ ls
    bla bla bla
    ```shell
    $ ls
    bla bla bla
    ```
    
    $ ls
    bla bla bla
  3. nwalters512 commented on Mar 28, 2025

    @nwalters512
    Contributor

    I'm working on a PR for this.

  4. JounQin commented on Mar 28, 2025

    @JounQin
    Member

    @nwalters512 Maybe also worth to upgrade linguist-languages dep at the same time, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions