UNPKG

rspress-plugin-code-block

Version:

Rspress plugin to import and display file contents as code blocks

10 lines (9 loc) 457 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); // 编译时处理,运行时直接渲染内容 const CodeBlock = ({ src, language }) => { // 实际内容会在编译时通过remark插件替换 return ((0, jsx_runtime_1.jsx)("pre", { children: (0, jsx_runtime_1.jsx)("code", { className: language ? `language-${language}` : '' }) })); }; exports.default = CodeBlock;