Releases: souporserious/mdxts
[email protected]
Minor Changes
- 35b05bd: Adds
css
prop forCodeInline
to allow merging css styles. - 9457424: Adds
CopyButton
to be used with customCodeBlock
components. - 801b9c3: Moves
GitProviderLink
to use css throughrestyle
instead of inline styles.
Patch Changes
- 511d768: Normalizes
CopyButton
foreground and background colors. - 2198401: Updates restyle to
1.4.0
. - bc2ef5e: Doesn't override user-defined pre margin in
CodeBlock
. - 1236bcc: Fixes keyboard accessibility for
CodeBlock
inline copy button. - 6a05a2a: Uses activity bar foreground color from theme to color source link and copy button icons in
CodeBlock
component. - 16e6f26: Adds better contrast for
CodeBlock
inline copy button by adding a stroke based ontheme.panel.border
.
[email protected]
Minor Changes
- 5e3a2b8: Adds a
gitProvider
option to themdxts/next
plugin. - 96a02e4: Removes the
fixImports
prop fromCodeBlock
. This prop fixed imports specifically for situtations like examples that are located in a different project and used relative imports. However, examples should use the library import path instead of relative paths by configuring themodule
field intsconfig.json
. More info here.
Patch Changes
[email protected]
Minor Changes
-
d36ef90: Adds a
loadHighlighterLanguage
utility for adding custom languages toCodeBlock
andCodeInline
. -
02b3f80: Adds
RenderedHTML
component for renderingchildren
as a highlighted HTML string in aCodeBlock
:import { CodeBlock, RenderedHTML } from 'mdxts' export function Basic() { return ( <div style={{ display: 'grid', gap: '2rem' }}> <div style={{ display: 'grid', gap: '1rem' }}> <h2>Input</h2> <CodeBlock language="jsx" value="<h1 style={{ fontSize: '6rem' }}>Hello World</h1>" /> </div> <div style={{ display: 'grid', gap: '1rem' }}> <h2>Output</h2> <RenderedHTML includeHtml={false}> <h1 style={{ fontSize: '6rem' }}>Hello World</h1> </RenderedHTML> </div> </div> ) }
[email protected]
Minor Changes
Patch Changes
[email protected]
Minor Changes
- e38535a: Uses
posix.sep
and normalizescreateSource
glob patterns. - 301629b: Fixes scrollbars for
CodeInline
components that overflow while also moving inline styles to use restyle. - ac9118e: Adds
allowCopy
prop toCodeInline
for rendering a persistent copy button. - 3cc2642: Moves
@types
packages from dependencies to dev dependencies to reduce npm install size. These should be included in the projectmdxts
is used in now e.g.npm install @types/react
.
Patch Changes
[email protected]
Patch Changes
- b35373c: Fixes error when trying to find previous version cache that doesn't exist yet.
[email protected]
Major Changes
- 05d31e7: MDXTS v1 is released! 🎉 Check out the announcement post for more details.
Patch Changes
[email protected]
Minor Changes
-
00f6547: Uses a slightly smaller filename font size for the
CodeBlock
toolbar by default. -
87ee6c4: Adds
Copyright
component to render copyright notices. -
8558c3f: Adds
GitProviderLink
andGitProviderLogo
components to render links and graphics for the configured git provider. -
999446c: Adds MDXTS assets for linking back to the MDXTS site:
import { BuiltWithMdxts } from "mdxts/assets"; export function Footer() { return ( <footer> <BuiltWithMdxts /> </footer> ); }
-
b7c7f0d: Removes default vertical padding for
CodeInline
component. -
fcb0a03: Now infers
gitSource
andsiteUrl
inmdxts/next
using Vercel environment variables if available.
Patch Changes
- 9a9d33a: Fixes using the initial value rather than the possibly transformed value in
CodeBlock
. - de7bad8: Fixes line numbers highlight styles.
- 759bb79: Fixes interaction when copy button covers code block text by hiding the copy button on the first pointer down until entering the code block area again.
- 2e384bb: Closes symbol popover on pointer down to allow selecting code block text.
- ef4b03a: Fixes unnecessarily rendering token when it is whitespace.
- 308c709: Normalizes
CopyButton
sizes across code components.
[email protected]
Minor Changes
-
b796c3f: Removes
LineHighlights
component in favor of simpler CSS approach for highlighting lines. -
cccf278: Renames
CodeBlock
lineHighlights
prop tohighlightedLines
.Breaking Changes
CodeBlock
lineHighlights
prop has been renamed tohighlightedLines
.
-
044d1ca: Renames
CodeBlock
toolbar
prop toshowToolbar
.Breaking Changes
CodeBlock
toolbar
prop has been renamed toshowToolbar
.
-
dfa9384: Fixes
CodeBlock
accessibility and markup by swappingdiv
s withspan
s and using acode
element around tokens. -
564806a: Renames
CodeBlock
lineNumbers
prop toshowLineNumbers
.Breaking Changes
CodeBlock
lineNumbers
prop has been renamed toshowLineNumbers
.
-
bd646c4: Adds
focusedLines
andunfocusedLinesOpacity
props to theCodeBlock
component to control focusing a set of lines and dimming the other lines. It uses an image mask to dim out the lines which can be controlled usingunfocusedLinesOpacity
:```tsx focusedLines="3-4" const a = 1; const b = 2; const result = a + b; console.log(result); // 3 ```
<CodeBlock value={`const a = 1;\nconst b = 2;\n\nconst add = a + b\nconst subtract = a - b`} focusedLines="2, 4" />
Patch Changes
- a02b1d8: Fixes copy button overlapping
CodeBlock
content by only showing the button when hovering the code block. The button now also sticks to the top right of the code block when scrolling.
[email protected]
Minor Changes
-
e493fbd: Refines
paths
returned fromcreateSource
andmergeSources
. Based on the glob pattern provided, either a one-dimensional or two-dimensional array of paths will be returned:import { createSource, mergeSources } from "mdxts"; const allPosts = createSource("posts/*.mdx").paths(); // string[] const allDocs = createSource("docs/**/*.mdx").paths(); // string[][] const allPaths = mergeSources(allDocs, allPosts).paths(); // string[] | string[][]
Likewise the
get
method will be narrowed to only accept a single pathname or an array of pathname segments:allPosts.get("building-a-button-component-in-react"); allDocs.get(["examples", "authoring"]);
Breaking Changes
- The
paths
method now returns a one-dimensional array of paths for a single glob pattern and a two-dimensional array of paths for multiple glob patterns. - The
get
method now only accepts a single pathname or an array of pathname segments.
You may need to update your code to accommodate these changes:
export function generateStaticParams() { -- return allPosts.paths().map((pathname) => ({ slug: pathname.at(-1) })) ++ return allPosts.paths().map((pathname) => ({ slug: pathname })) }
- The
-
7444586: Now
createSource.get
attempts to prepend the incoming pathname withbasePathname
if defined and no data was found.
Patch Changes
- 6d338a6: Handles null values and throws an error for undefined values when formatting front matter for type checking.