GithubHelp home page GithubHelp logo

fabiogiolito / walkthrough.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 165 KB

A plugin for Prism.js to create code walkthroughs and tutorials.

Home Page: https://fabiogiolito.github.io/Walkthrough

CSS 40.34% HTML 33.05% JavaScript 26.61%

walkthrough.js's Introduction

Walkthrough

A Plugin for Prism.js.

Add comments to your Prism code blocks to create walkthroughs and tutorials.

Demo: https://fabiogiolito.github.io/Walkthrough/

Usage

Use the data-comments attribute to define and array of objects following the format {"lines":"text"}. Please note that Javascript objects must use double quotes to be valid.

<pre
  class="language-markup line-numbers"
  data-comments='[
    {"3-8":"A comment highlighting lines 3 to 8."},
    {"4":"Another comment, highlighting line 4."},
    {"":"A comment without line highlighting"},

  ]'
>
  <code></code>
</pre>

The line definition follows the line-highlight prism plugin. You can set a range (3-6) or specific lines (3,6,9).

Not defining a line shows your comment without the line-highlight.

Screenshot

code block screenshot

Instalation

Installing is pretty straightforward. Copy the plugin JS and CSS files from the plugin folder into your project and add them to your page after the Prism code.

<script src="prism/prism.js"></script>
<link rel="stylesheet" href="prism/prism.css">

<script src="plugin/walkthrough.js"></script>
<link rel="stylesheet" href="plugin/walkthrough.css">

Make sure you have the Line Highlight plugin installed as it is required for this plugin to work properly. It can be found on PrismJS.com when you download the Prism.js files.

Line numbers, Theme colors, Languages support and more are also part of Prism.js and can be found on PrismJS.com

Customization

Customizing your code blocks and comments is easy with CSS. Add a custom class to your pre element and override the style of any element inside it.

Screenshot

customized code block screenshot

walkthrough.js's People

Contributors

fabiogiolito avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.