Skip to content

fix(ec-twoslash): improve code block processing#91

Merged
Adammatthiesen merged 1 commit into
mainfrom
adam/ec-cleanup
Feb 27, 2026
Merged

fix(ec-twoslash): improve code block processing#91
Adammatthiesen merged 1 commit into
mainfrom
adam/ec-cleanup

Conversation

@Adammatthiesen

Copy link
Copy Markdown
Member

This pull request enhances the codeblock processing for the expressive-code-twoslash package to improve the accuracy and reliability of Twoslash code block handling. The main focus is on ensuring that extra lines not present in the Twoslash output are removed, refining module resolution, and improving compatibility with ESLint and emitted code display.

Codeblock processing improvements:

  • Improved the removal of extra lines from code blocks by iterating backwards and checking for line existence before deletion, ensuring no orphaned lines remain in the final output.

Module resolution and configuration:

  • Refactored the way TSConfig paths and default library directories are resolved and used, clarifying variable naming and ensuring proper module resolution for Twoslash.

ESLint and emitted code handling:

  • Adjusted the file extension logic so that when the trigger is "eslint", the code block receives a full filename with extension, improving ESLint's Twoslasher parsing and completions.
  • Enhanced the update of code block language when displaying emitted code (e.g., via @showEmit), ensuring the output language matches the emitted result, which could be TypeScript, JavaScript, JSON, or .d.ts.

Documentation:

  • Added a changeset documenting the patch, explaining that extra lines not present in the Twoslash output are now excluded from the final code block output.

@changeset-bot

changeset-bot Bot commented Feb 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b9a5f3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
expressive-code-twoslash Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@htg-1-studiocms-cloud

htg-1-studiocms-cloud Bot commented Feb 26, 2026

Copy link
Copy Markdown

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
Expressive-Code-Twoslash Docs ✅ Done Preview URL 2026-02-26T22:03:44.532Z

@pkg-pr-new

pkg-pr-new Bot commented Feb 26, 2026

Copy link
Copy Markdown
css-js-gen

npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash/css-js-gen@91

expressive-code-twoslash

npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash@91

@ec-ts/twoslash

npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash/@ec-ts/twoslash@91

@ec-ts/twoslash-vue

npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash/@ec-ts/twoslash-vue@91

@ec-ts/vfs

npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash/@ec-ts/vfs@91

commit: 0b9a5f3

@apollo-git-bot

Copy link
Copy Markdown
Contributor

Allure Report Summary

Name Duration Stats New Flaky Retry Report
css-js-gen Tests 11ms Passed tests 37 37 0 0
@ec-ts/twoslash Tests 29s 314ms Passed tests 29 29 0 0
@ec-ts/twoslash-vue Tests 6s 3ms Passed tests 7 7 0 0
@ec-ts/vfs Tests 9s 589ms Passed tests 21 21 0 0

@Adammatthiesen Adammatthiesen marked this pull request as ready for review February 26, 2026 22:05
@Adammatthiesen Adammatthiesen requested a review from a team as a code owner February 26, 2026 22:05
@Adammatthiesen Adammatthiesen merged commit d5482fe into main Feb 27, 2026
11 checks passed
@Adammatthiesen Adammatthiesen deleted the adam/ec-cleanup branch February 27, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants