Giter Club home page Giter Club logo

wp-highlightjs's Introduction

WP HighlightJS

Loads highlight.js and clipboard.js on single pages in WordPress for syntax highlighting with a 1-click copy to clipboard button.

Screenshot

Live Example.

From 768px and below, it will always appear.

Included Theme:

  • GitHub Dark Dimmed

Included Languages:

  • HTML, XML
  • CSS
  • PHP
  • JavaScript
  • JSON
  • Markdown
  • Plain text
  • SCSS

Installation

  1. Click on the Download ZIP button at the right to download the plugin.

  2. Upload the entire wp-highlightjs folder to the /wp-content/plugins/ directory.

  3. Activate the plugin through the Plugins menu in WordPress.

Usage

In WordPress' Gutenberg editor, type / to begin typing code and hit return when you see a match.

Paste your code.

If using Oxygen, wrap your code in a code element and that in a pre element having a class of wp-block-code.

Ensure that there are no spaces between the HTML tags.

Screenshot.

Changelog

2.0.4 - May 27, 2022

  • Made the script to load on all singular pages, not just posts.
  • Fixed JS error with the forEach loop in the initilization script.
  • Updated highlight.js and clipboard.js libraries to their latest versions.
  • Removed the call to Google for the Source Code Pro font. It is now included in the plugin.
  • Replaced the syntax highlighting theme with "GitHub Dark Dimmed".
  • Replaced wp_localize_script() with wp_add_inline_script() for passing the copy icon's URL from PHP to JS.

2.0.3 - Aug 20, 2021

  • Updated deprecated HLJS Function. Thanks to Taylor.

2.0.2 - Aug 07, 2021

  • Updated highlight.js and clipboard.js libraries to their latest versions.
  • Removed "word-wrap: break-word" block for body element in CSS.
  • Set the plugin to load only on singular posts and not all singular pages.

2.0.1 - Jan 11, 2021

  • Updated highlight.js and clipboard.js libraries to their latest versions.
  • Misc. CSS fixes.

2.0.0 - August 21, 2019

  • Updated highlight.js and clipboard.js libraries to their latest versions.
  • Updated init js file to fix errors in the console.
  • Plugin name is not hardcoded any more in the init js file.
  • Replaced Github color theme with Gruvbox Dark.

1.0.0

  • Initial Release

Others

Tested up to: 5.8

License: GPLv2 or later

License URI: http://www.gnu.org/licenses/gpl-2.0.html

Donate link: https://www.paypal.me/sridharkatakam

wp-highlightjs's People

Contributors

srikat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wp-highlightjs's Issues

Update deprecated HLJS Function

Deprecated as of 10.6.0. initHighlightingOnLoad() deprecated. Use highlightAll() now.

Screenshot 2021-08-19 at 20 58 46

Change line 61 in assets/js/highlight-init.js to:

hljs.highlightAll();

Choose color theme

Wouldnt it be better if we could pick the color theme with a dropdown in the backend somewhere

Support gist

I think it would be nice to uniformly include gists on a page with blocks of code created with this plugin

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.