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. Asp.Net Core 入门(四)—— Model、View、Controller

    和我们学习Asp.Net MVC一样,Asp.Net Core MVC的Model.View.Controller也和我们熟悉的Asp.Net MVC中的相似.不同的是我们在使用Asp.Net Cor ...

  2. python django项目断点调试

  3. centos nginx uwsgi django

    doc link uwsgi link video link

  4. Android流行界面结构——Fragment通过ViewPager(带指示器)嵌套Fragment结构的创建方法详解

    原创文章,转载请注明出处http://www.cnblogs.com/baipengzhan/p/6287213.html 当前Android流行界面结构的一种——Fragment通过ViewPage ...

  5. luogu P1618 三连击(升级版)

    题目描述 将1,2,…,9共9个数分成三组,分别组成三个三位数,且使这三个三位数的比例是A:B:C,试求出所有满足条件的三个三位数,若无解,输出“No!!!”. //感谢黄小U饮品完善题意 输入输出格 ...

  6. thinkphp5实现文件上传

    原理:通过form表单的enctype = "multipart / form-data"属性将文件临时放在htdocs文件夹的tmp目录下,再通过后台的程序将文件保存在自己设定的 ...

  7. python的2种字符串格式化输出

    字符串格式化代码(typecode) 法一: %格式使用下面的格式 %[(name)] [flags] [width][.precision] typecode (name)输出字典的value使用, ...

  8. BERT模型介绍

    前不久,谷歌AI团队新发布的BERT模型,在NLP业内引起巨大反响,认为是NLP领域里程碑式的进步.BERT模型在机器阅读理解顶级水平测试SQuAD1.1中表现出惊人的成绩:全部两个衡量指标上全面超越 ...

  9. Python补充--Python内置函数清单

    Python内置函数 Python内置(built-in)函数随着python解释器的运行而创建.在Python的程序中,你可以随时调用这些函数,不需要定义.最常见的内置函数是: print(&quo ...

  10. Leetcode 273.整数转换英文表示

    整数转换英文表示 将非负整数转换为其对应的英文表示.可以保证给定输入小于 231 - 1 . 示例 1: 输入: 123 输出: "One Hundred Twenty Three" ...