Skip to content

Embedded section doesn't look too nice with background color for block scalars #15

Open
@FichteFoll

Description

@FichteFoll

Currently, the embedded script sections of block scalars start at the first non-whitespace character and terminate at the last newline before another token starts, usually a list entry or anther mapping key. When using a different background color for embedded code, this doesn't look so nice. What I'f prefer is starting the embedded scope at the first character of the new line that the embedded code begins and end it at the last newline that still has content so that the separating newline does not get the scope. The former should be trivial, but the former will require branching (on each line ending). However, I consider that worth it because yaml pipeline files aren't that long generally and it's visually much more appealing.

It's arguably quite common to have the script block at the end of a list entry, with the entries separated by a blank line.

Example (github):

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          lfs: true

      - name: Install pnpm
        uses: pnpm/action-setup@v2
        with:
          version: 8.10.0

      - name: Install Node
        uses: actions/setup-node@v3
        with:
          node-version: 20
          check-latest: true
          cache: 'pnpm'

      - name: Install Dependencies
        run: |
          pnpm install

      - name: Check Dependencies
        run: |
          pnpm list --recursive
          pnpm licenses list
          pnpm outdated --recursive

      - name: Check pnpm
        run: |
          pnpm doctor

      - name: Build Docs
        run: |
          pnpm run build

      - name: Deploy Docs
        uses: peaceiris/actions-gh-pages@v3
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          publish_dir: docs/.vitepress/dist
          cname: docs.sublimetext.io

2023-11-01_11-15-52

Scheme rule (I only have a tmTheme one but it's easily adapted):

		<dict>
			<key>name</key>
			<string>Embedded Source</string>
			<key>scope</key>
			<string>(source source, text source - text.html) - (source.js.embedded.html, source.ts.embedded.html, source.css.embedded.html, source.sass.embedded.html), markup.raw - punctuation.definition.raw</string>
			<key>settings</key>
			<dict>
				<key>background</key>
				<string>#ffffff10</string>
			</dict>
		</dict>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions