[Feat]: Add code processing to annotations #19
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant changes to the
twoslash
package, focusing on integrating Expressive Code for better code block rendering and simplifying the handling of annotations. The most important changes include the addition of Expressive Code dependencies, refactoring of annotation classes, and updates to helper functions to support the new rendering system.Integration of Expressive Code:
packages/twoslash/package.json
: Addedexpressive-code
as a dependency.packages/twoslash/src/index.ts
: Integrated Expressive Code into theecTwoSlash
function for rendering code blocks and annotations. [1] [2]Refactoring of Annotation Classes:
packages/twoslash/src/annotations/hover.ts
: RefactoredTwoslashHoverAnnotation
to userenderType
andrenderJSDocs
for rendering hover information and documentation. [1] [2]packages/twoslash/src/annotations/static.ts
: RefactoredTwoslashStaticAnnotation
similarly to the hover annotation class. [1] [2]Updates to Helper Functions:
packages/twoslash/src/helpers.ts
: Added new functionsrenderMarkdownWithCodeBlocks
,renderMDInline
,renderJSDocs
, andrenderType
to handle markdown processing and rendering with Expressive Code. [1] [2]Code Cleanup:
packages/twoslash/src/annotations/hover.ts
andpackages/twoslash/src/annotations/static.ts
: Removed redundant helper imports and functions. [1] [2]Styling Updates:
packages/twoslash/src/styles.ts
: Added new CSS rules to style the rendered code blocks and annotations.