New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gist-simple

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gist-simple

JS for Gist code block loading

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

Gist Simple

JS for Gist code block loading.

Demo

Table of Contents

Import Gist Simple

Use one of the following examples to import Gist Simple.

ESM

We provide a version of Gist Simple built as ESM (gist-simple.esm.js and gist-simple.esm.min.js) which allows you to use Gist Simple as a module in your browser, if your targeted browsers support it.

<script type="module">
  import gistSimple from "gist-simple.esm.min.js";
</script>

ESM CDN

<script type="module">
  import gistSimple from "https://cdn.jsdelivr.net/npm/gist-simple@2/+esm";
</script>

UMD

Gist Simple may be also used in a traditional way by including script in HTML and using library by accessing window.gistSimple.

<link type="text/css" rel="stylesheet" href="gist-simple.css">
<script src="gist-simple.min.js"></script>

UMD CDN

<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gist-simple@2/dist/gist-simple.css">
<script src="https://cdn.jsdelivr.net/npm/gist-simple@2/dist/gist-simple.min.js"></script>

CJS (Bundlers like Webpack)

Install Gist Simple as a Node.js module using npm

npm install gist-simple

Import Gist Simple by adding this line to your app's entry point (usually index.js or app.js):

import gistSimple from "gist-simple";

Call the plugin

A. Data attribute way

<div class="gist-simple" data-id="b58861072e53b12430ec2f78a99dbe4d" data-file="example-1.html"></div>

Note: You can use all available options as data attributes. For example: data-id, data-file, data-show-footer, etc...

B. JavaScript way

gistSimple(document.querySelector('.gist-simple'), {
  id: 'b58861072e53b12430ec2f78a99dbe4d',
  file: 'example-1.html',
});

C. jQuery way

$('.gist-simple').gistSimple({
  id: 'b58861072e53b12430ec2f78a99dbe4d',
  file: 'example-1.html',
});
No conflict (only if you use jQuery)

Sometimes to prevent existing namespace collisions you may call .noConflict on the script to revert the value of.

const gistSimplePlugin = $.fn.gistSimple.noConflict() // return $.fn.gistSimple to previously assigned value
$.fn.newGistSimple = gistSimplePlugin // give $().newGistSimple the Gist Simple functionality

Options

NameTypeDefaultDescription
idstring``Gist ID.
themestringsystemTheme: system, light, dark.
filestring``Specific file name.
captionstring``Caption, that will be shown above code.
linesstring``Show only specific code lines. Example: "2", "1-5", "1,4", "1,4,6-8".
linesExpandedbooleanfalseHidden lines may be expanded.
highlightLinesstring``Highlight specific code lines. Example: "2", "1-5", "1,4", "1,4,6-8".
showFooterbooleantrueShow footer section.
showLineNumbersbooleantrueShow line numbers section.
enableCachebooleantrueEnable AJAX caching.

For Developers

Installation

  • Run npm install in the command line

Building

  • npm run dev to run build and start local server with files watcher
  • npm run build to run build

Linting

  • npm run js-lint to show eslint errors
  • npm run js-lint-fix to automatically fix some of the eslint errors

Keywords

FAQs

Package last updated on 06 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc