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. 【转】密码学 :CSP的概念

    转:[密码学]CSP的概念 CSP加密服务提供者(Cryptographic Service Provider)具有一下几个特点: CSP是真正执行密码运算的独立模块 物理上一个CSP由两部分组成:一 ...

  2. 数的计数(noip2001,动态规划递推)

    题目链接: 普通版: https://www.luogu.org/problemnew/show/P1028 数据加强版: https://www.luogu.org/problemnew/show/ ...

  3. MySQL(C#的链接姿势)

    介绍 这篇随笔主要介绍MySQL的基础API的使用姿势 基本使用姿势: 第一步:登陆数据库 string connStr = "Database=start;datasource=127.0 ...

  4. static静态方法的优缺点

    static可以修饰成员变量,成员方法,代码块,类特点: static修饰的方法和变量,为类所属方法和变量,不会在对象销毁时销毁,所以生命周期较长.被static修饰的内容会随着类的加载而加载,优先于 ...

  5. python基础——3(流程控制)

    一.if判断 1.语法一: if 条件: 子代码块 示例代码: sex = 'female' age = 18 is_beautiful = True if sex == 'female' and a ...

  6. Leetcode 309.最佳买卖股票时机含冷冻期

    最佳买卖股票时机含冷冻期 给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格.​ 设计一个算法计算出最大利润.在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票): 你不 ...

  7. apache kafka系列之server.properties配置文件参数说明

    每个kafka broker中配置文件server.properties默认必须配置的属性如下: broker.id=0num.network.threads=2num.io.threads=8soc ...

  8. 多边形之战(bzoj 2927)

    Description 多边形之战是一个双人游戏.游戏在一个有n个顶点的凸多边形上进行,这个凸多边形的n-3条对角线将多边形分成n-2个三角形,这n-3条对角线在多边形的顶点相交.三角形中的一个被染成 ...

  9. 字符串匹配(codevs 1404)

    题目描述 Description 给你两个串A,B,可以得到从A的任意位开始的子串和B匹配的长度.给定K个询问,对于每个询问给定一个x,求出匹配长度恰为x的位置有多少个.N,M,K<=20000 ...

  10. Codeforces 513G1 513G2 Inversions problem [概率dp]

    转自九野:http://blog.csdn.net/qq574857122/article/details/43643135 题目链接:点击打开链接 题意: 给定n ,k 下面n个数表示有一个n的排列 ...