If you have a presentation coming up or you just need to present some documentation, then the Code Surfer React component is a powerful way to Highlight, Zoom, and Scroll snippets of code. This component is particularly designed to work with mdx-deck, which is a MDX-based presentation framework that enables easy slide creation with markdown and React components.

https://github.com/pomber/code-surfer https://github.com/jxnblk/mdx-deck

Install:

npm init deck my-code

It creates a mdx-deck project with dependcies installed.

Run:

npm start

You should be able to see a basic mdx-deck project running.

Install:

npm i -D mdx-deck-code-surfer raw-loader

Modify:

import {CodeSurfer} from "mdx-deck-code-surfer"

<CodeSurfer
code="console.log('Hello World')"
/>

Import snippet:

Should also using raw-loader

import {CodeSurfer} from "mdx-deck-code-surfer"

<CodeSurfer
code={require("raw-loader!./snippets/1.snippet")}
/>

More example:

import {CodeSurfer} from "mdx-deck-code-surfer"

<CodeSurfer
code={require("raw-loader!./snippets/2.snippet")}
title="Snippet from vusjs"
notes="Vuejs + rxjs +Typescript"
showNumbers={true}
lang="javascript"
steps={[
{ lines: [6], notes: "Note for the first step" },
{ range: [5, 9] },
{ ranges: [[4,6], [1, 3]] },
{ tokens: { 9: [3, 4] }, notes: "Note for the third step" },
{range: [30,33], notes: "Scroll"}
]}
/>

GIthub

[Tools] Scroll, Zoom, and Highlight code in a mdx-deck slide presentation with Code Surfer <🏄/>的更多相关文章

  1. Chrome Dev Tools: Code Folding in CSS and Javascript for improved code readiability

    Note : Apply for google chrome canary. You can fold code blocks in CSS (and Sass) and javascript fil ...

  2. VS Code 中文社区正式成立啦!VS Code Day 圆满落幕!

    背景简介 Visual Studio Code 是一款现代化轻量级代码编辑器,它免费.开源.跨平台.功能强大.本次 VS Code Day 是广大 VS Code 爱好者一起学习与交流的盛会,让我们对 ...

  3. EF Code First教程-01 创建一个简单的Code First程序

    1 从nuget中搜索并添加EF 2 在app.config或web.config中添加数据库连接 <connectionStrings> <add name="conns ...

  4. iphone dev 入门实例6:How To Use UIScrollView to Scroll and Zoom and Page

    http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content Getting Starte ...

  5. 10 Code Coverage Tools for C & C++

    Code coverage is a measure used in software testing that describes the degree to which the source co ...

  6. The Ultimate List of Open Source Static Code Analysis Security Tools

    https://www.checkmarx.com/2014/11/13/the-ultimate-list-of-open-source-static-code-analysis-security- ...

  7. Top 40 Static Code Analysis Tools

    https://www.softwaretestinghelp.com/tools/top-40-static-code-analysis-tools/ In this article, I have ...

  8. 计算机视觉code与软件

    Research Code A rational methodology for lossy compression - REWIC is a software-based implementatio ...

  9. Delphi Code Editor 之 编辑器选项

    Delphi Code Editor 之 编辑器选项 可从Code Editor的右键菜单中选择“Properties”菜单项来查看编辑器选项.也可以从主菜单[Tools | Editor Optio ...

随机推荐

  1. Vue.js Extension Pack 和 jsconfig.json 可以定位跳转到@开头的路径等自定义路径

    Vue.js Extension Pack | vsCode插件 可以定位跳转到@开头的路径等自定义路径 webpack自定义别名后,VScode路径提示问题 //tsconfig.json 或者 j ...

  2. 时钟Demo

    其实是一个很简单的Demo,可以编译了拿NSIS打包.最近在做富文本编辑器和补C++不记得的东西吧,项目遥遥无期. //clock.pro #----------------------------- ...

  3. ios7与ios6UI风格区别

    http://apple.xdnice.com/content/applenews/2013/0614/142195.html         (ios7 ui风格) http://blog.csdn ...

  4. Sqlserver查询结果集插入新表

    数据库“Test” 数据库“Test2” 表 “fromTable” 表 “toTable” 表 “newTable” 字段 “name”,“age”,“gender” 原因:公司有2个数据库,一个是 ...

  5. 模拟--P1328 生活大爆炸版石头剪刀布 题解

    P1328 生活大爆炸版石头剪刀布 这也是打表么?? #include <iostream> using namespace std; static const auto y = []() ...

  6. mysql 报错Authentication method 'caching_sha2_password' is not supported

    原文地址:https://blog.csdn.net/u011583336/article/details/80999043 之前工作中用的数据库多是ms sqlserver,偶尔用到mysql都是运 ...

  7. dotTrace激活服务器

    http://active.09l.me IntelliJ IDEA 7.0 或 更高DataGrip 1.0或更高ReSharper 3.1 或更高ReSharper Cpp 1.0 或更高dotT ...

  8. 如何用纯 CSS 创作一个荧光脉冲 loader 特效

    效果预览 在线演示 按下右侧的"点击预览"按钮在当前页面预览,点击链接全屏预览. https://codepen.io/zhang-ou/pen/erRzzR 可交互视频教程 此视 ...

  9. Postfix telnet www.azengna.com 25 Connection Refused 但是localhost连接成功

    修改配置文件 vi /etc/postfix/main.cf 原先配置信息 .... inet_interfaces = all #inet_interfaces = $myhostname,loca ...

  10. Tomcat启动慢(运行shutdown.sh的时候报错)

    Using CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: / ...