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

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

Open
FichteFoll opened this issue Nov 1, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@FichteFoll
Copy link
Member

FichteFoll commented Nov 1, 2023

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>
@keith-hall keith-hall added the enhancement New feature or request label Nov 19, 2023
@keith-hall
Copy link
Member

I addressed the leading whitespace in 00c4f67. The trailing separator line seems like it could be trickier, because currently it is part of an embed/escape pattern, so not sure how branching will be able to interact with that. PRs welcome.

@keith-hall keith-hall added the help wanted Extra attention is needed label Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants