@@ -19,6 +19,7 @@ import { plainHighlight } from './plain-highlight';
1919type ClientBlockProps = Pick < BlockProps < DocumentBlockCode > , 'block' | 'style' > & {
2020 inlines : RenderedInline [ ] ;
2121 inlineExprVariables : InlineExpressionVariables ;
22+ mode : BlockProps < DocumentBlockCode > [ 'context' ] [ 'mode' ] ;
2223} ;
2324
2425export const CODE_BLOCK_DEFAULT_COLLAPSED_LINE_COUNT = 10 ;
@@ -28,7 +29,7 @@ export const CODE_BLOCK_DEFAULT_COLLAPSED_LINE_COUNT = 10;
2829 * It allows us to defer some load to avoid blocking the rendering of the whole page with block highlighting.
2930 */
3031export function ClientCodeBlock ( props : ClientBlockProps ) {
31- const { block, style, inlines, inlineExprVariables } = props ;
32+ const { block, mode , style, inlines, inlineExprVariables } = props ;
3233 const blockRef = useRef < HTMLDivElement > ( null ) ;
3334 const isInViewportRef = useRef ( false ) ;
3435 const [ isInViewport , setIsInViewport ] = useState ( false ) ;
@@ -123,7 +124,9 @@ export function ClientCodeBlock(props: ClientBlockProps) {
123124 const numberOfLinesOfCode = lines ?. length ?? plainLines . length ;
124125 const collapsedLineCount =
125126 block . data . collapsedLineCount || CODE_BLOCK_DEFAULT_COLLAPSED_LINE_COUNT ;
126- const isExpandable = Boolean ( expandable && numberOfLinesOfCode > collapsedLineCount ) ;
127+ const isExpandable = Boolean (
128+ expandable && mode !== 'print' && numberOfLinesOfCode > collapsedLineCount
129+ ) ;
127130
128131 const codeBlockBodyId = useId ( ) ;
129132
0 commit comments