Coder Social home page Coder Social logo

grav-plugin-pygments's Introduction

Pygments (Grav plugin)

  • Because I <3 Grav, but I also <3 Pygments.

  • Because I </3 Javascript and thus don't want to use a Javascript-based syntax highlighter.

  • Because I wanted to be able to have a nicer syntax than '''PHP, and a syntax to specify a title (in the way the Archlinux' Wiki does) and to highlight particular lines.

  • Because I wanted to test Grav's plugins system.

What does it do?

Once installed, the plugin will post-process every page and look for codes in the page. To avoid interacting with other plugins, it only processes the codes begining with Grav-style headers, something like:

Aut doloremque est vitae et dolor. Error omnis autem distinctio. Officia
molestias neque temporibus quia numquam voluptatum. Ut veniam repudiandae
occaecati. Porro architecto recusandae accusantium.

    ---
	language: PHP
	highlights: [5, 8, 10]
	title: /home/niols/public_html/index.php
	---
	
	<?php
	echo 'Hello, World!';

Qui impedit quis dolorem repellat suscipit voluptas corporis cum. Nostrum
consequatur eaque veniam ipsa. Animi corrupti quis ratione voluptatem ut
rerum ullam. Laborum ipsam dicta et aperiam libero iusto. Doloremque id
animi vel. Ea nostrum cum facilis tempore iusto incidunt voluptas.

The Grav-style headers must be a Yaml value between two ---. The supported headers are:

  • language: one of the languages supported by Pygments. If not provided, Pygments will try to guess.

  • highlights: a list of lines to highlight.

  • title: a title to add before the code.

  • file: if provided, the content of the given file will be taken instead of the body of the code.

grav-plugin-pygments's People

Contributors

niols avatar

Watchers

 avatar  avatar  avatar

grav-plugin-pygments's Issues

I don't understand how it works

Hi, sorry I don't understand how this plugin works, i installed this plugin with no problem.
Before I had the plugin Highlight, and I wanted to test your plugin, because Pygments is better.

But when I have this syntax in my markdown for example :

hostnamectl set-hostname stnetwork.fr
hostnamectl status
nano /etc/hosts
service network restart

It appears like this :
http://imgur.com/a/tqFzq

that doesn't work, what must I do ?

Relative file path

I want to be able to write:


---
file: ../foo.bar

---

with a path relative to the markdown's one

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.