phryneas / remark-typescript-tools

MIT License
129 stars 7 forks source link

✨ Add option to maintain snippet height #9

Closed Shrugsy closed 2 years ago

Shrugsy commented 3 years ago

Allow transpilation to pad JS snippet with newlines where it would otherwise be shorter than the corresponding TS snippet

The goal here is to prevent the page height & scroll position from jumping when toggling between TS/JS snippets. I've added it as an opt-in option maintainSnippetHeights to compilerSettings.

Shrugsy commented 3 years ago

FYI this is a demo of what this would change on the RTK docs

Before (page jumping/jitteriness) After (no page jumping)
ts-js-toggle-before ts-js-toggle-after
Shrugsy commented 3 years ago

FYI I've opened https://github.com/facebook/docusaurus/pull/5618 on the docusarus repo, which if accepted, will be a more suitable solution, and this PR can be closed

Shrugsy commented 2 years ago

Closed due to https://github.com/facebook/docusaurus/pull/5618 being merged into docusaurus, which makes this change redundant and subpar