GithubHelp home page GithubHelp logo

isabella232 / prettify-extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from showdownjs/prettify-extension

0.0 0.0 0.0 22 KB

Prettify extension for Showdown.js

License: BSD 2-Clause "Simplified" License

JavaScript 94.36% HTML 5.64%

prettify-extension's Introduction

Showdown's Prettify Extension

Build Status npm version npm version


An extension to add Google Prettify hints to showdown's HTML output

Installation

With npm

npm install showdown-prettify

With bower

bower install showdown-prettify

Manual

You can also download the latest release zip or tarball and include it in your webpage, after showdown:

<script src="showdown.min.js">
<script src="showdown-prettify.min.js">

Enabling the extension

After including the extension in your application, you just need to enable it in showdown.

var converter = new showdown.Converter({extensions: ['prettify']});

Example

var converter = new showdown.Converter({extensions: ['prettify']}),
    input = "Here's a simple hello world in javascript:\n" +
            "\n" +
            "    alert('Hello World!');\n" +
            "\n" +
            "The `alert` function is a build-in global from `window`.";
    html = converter.makeHtml(input);
    console.log(html);

This should output the equivalent to:

<p>Here's a simple hello world in javascript:</p>

<pre class="prettyprint linenums" tabIndex="0"><code data-inner="1">alert('Hello World!');
</code></pre>

<p>The <code class="prettyprint">alert</code> function is a build-in global from <code class="prettyprint">window</code>.</p>

License

These files are distributed under BSD license. For more information, please check the LICENSE file in the source code.

prettify-extension's People

Contributors

syntaxrules avatar tivie 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.