Giter Site home page Giter Site logo

tajmone / pandoc-goodies Goto Github PK

View Code? Open in Web Editor NEW
209.0 7.0 41.0 322 KB

A tresure-box of resources for pandoc, pp and Texts word processor.

License: MIT License

Pascal 6.91% Batchfile 4.80% HTML 52.42% CSS 33.98% Shell 0.90% PureBasic 0.12% JavaScript 0.87%
pandoc pandoc-templates skylighting-themes pp macros macro-library

pandoc-goodies's Introduction

Pandoc-Goodies

pandoc v2.7.2 | PP v2.8

A tresure-box of resources for pandoc, pp and the Texts word processor.

Copyright © Tristano Ajmone 2017, MIT License.

The project is still WIP and in its early stages, but a pandoc html5 template is ready for use, along with a growing pp-macros library.

PROJECT UPDATED — After over a year without updates, all repository assets have been updated to pandoc v2.7.2 and PP v2.8. Minor tweaks were required to ensure that everything worked fine as before. Also, the project now uses Dart Sass, instead of Ruby Sass.


Table of Contents


Available Goodies

Pandoc HTML5 Templates

Currently, there's only one template available:

PP Macros

  • /pp/ — The PP-Macros Library

The pp-macros section is an ongoing effort to create a collection of pp macros to extend pandoc's markdown workflow by providing means to use GFM task lists in markdown source file, external syntax highlighters, and many more features.

About PP: PP is a text preprocessor designed for Pandoc (and more generally Markdown and reStructuredText). It's cross-platform and available as a single standalone binary file:

Skylighting Assets

This directory tree gathers various assets for Skylighting, the syntax highlighter used by pandoc — currently only themes and stylesheets, but in the future it might host also additional syntax definitions.

Skylighting CSS

The skylighting CSS section contains resources for styling code blocks in HTML format — via CSS and Sass.

Skylighting Themes

The skylighting themes section contains resources for customizing syntax highlighting styles via KDE theme files (JSON).

Related Projects

Here is a list of other pandoc-related projects which you might be interested in visiting:

  • GitHub Pages Themes Magick — Create a repo's GitHub Pages website from its README.md file via pandoc and pandoc templates (now supports pandoc v2).

Third Party Code Credits

The "Pandoc-Goodies" project reuses third party source code from the following projects:

You'll find more details and license information in the documentation of the subfolders.

Notes About Pandoc License

Some legal stuff you should be aware regarding the license terms governing pandoc and some of its built-in resources.

Pandoc is (c) 2006-2017 John MacFarlane, released under the GPL v2 (or greater) license.

The built-in styles (aka syntax themes) that pandoc injects into the final documents also fall under the same GPL v2 license as pandoc.

Pandoc's built-in default templates are dual-licensed — under both the GPL (v2 or higher, same as pandoc) and the BSD 3-clause ("New" or "Revised") license:

You should be aware that the built-in syntax highlighting styles are not part of the templates, and therefore are not subject to dual-licensing. Styles are added at conversion time (for those format that support highlighting). Since pandoc's default templates rely on the built-in styles, syntax highlighting might (depending on output format) automatically include into the final document a built-in style ("pygments", by default). Since highligthing-styles are governed by the GPL v2 license (which demands same licensing), opting for the BSD 3-clause license might no longer apply to the final document if the template and the styling are woven together into a single file.

For a more detailed explanation regarding HTML templates and CSS styles, see:

GPLv2 vs BSD-3

A quick reference summary of both GPL v2 and BSD 3-clause licenses — Text excerpts and tables taken from choosealicense.com (license: CC BY 3.0):

GNU General Public License v2.0

The GNU GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license. There are multiple variants of the GNU GPL, each with different requirements.

Permissions Conditions Limitations
✔ Commercial use ✔ Disclose source ✘ Liability
✔ Distribution ✔ License and copyright notice ✘ Warranty
✔ Modification ✔ Same license
✔ Private use ✔ State changes

BSD 3-clause "New" or "Revised" License

A permissive license similar to the BSD 2-Clause License, but with a 3rd clause that prohibits others from using the name of the project or its contributors to promote derived products without written consent.

Permissions Conditions Limitations
✔ Commercial use ✔ License and copyright notice ✘ Liability
✔ Distribution ✘ Warranty
✔ Modification
✔ Private use

pandoc-goodies's People

Contributors

hoijui avatar tajmone avatar timcharper 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandoc-goodies's Issues

GitHub.html5 and `<....`

hello,

I'm just trying to use GitHub.html5 for one of a file that contains quotes (an example of the source below), and see the next output

"template" (line 857, column 107):
unexpected "<"
expecting letter

It seems that the template does not handle quotes

the source

The system shall use the following requirements file format:

```markdown
# [<id>] <title>
{{
<attribute1>: value1
<attribute2>: value2  
}}
<body>

## [<id>] <title>
<body>

native gfm task list as lua-filter

Hi @tajmone !

I just wanted to inform you and the others, that there is now a lua-filter which implements the gfm task lists.
It is maintained by john mcfarlane and works on the AST.
Propably this is a better approach than to do it with pp.
Maybe you could make a note about that in the readme here, that it may be better to use this lua-filter instead of your code?

I don't want to make your contributions bad, though, and I want to thank you again for your efforts.

Line numbering?

First off, many thanks for these goodies, they are really nice!

This is a question rather than an issue/feature request: I do not seem to be able to get visible line numbering working with your github html5 theme. Could you point out any obvious errors please?

I am working on the following markdown file, using the newest version of GitHub.md from this repo.

---
title: test
---

```{.numberLines}
SQUIRE TRELAWNEY, Dr. Livesey, and the rest of these gentlemen having
asked me to write down the whole particulars about Treasure Island, from
the beginning to the end, keeping nothing back but the bearings of the
island, and that only because there is still treasure not yet lifted, I
take up my pen in the year of grace 17__ and go back to the time when
my father kept the Admiral Benbow inn and the brown old seaman with the
sabre cut first took up his lodging under our roof.

I produce html like this:

pandoc -s --template=~/.pandoc/templates/GitHub.html5 < test.md    

The resulting html does not include line numbers when rendered in my browser.
The relevant part of the source is this.

<body>
<article class="markdown-body">
<header>
<h1 class="title">test</h1>
</header>
<div class="sourceCode" id="cb1"><pre
class="sourceCode numberSource numberLines"><code class="sourceCode"><span id="cb1-1"><a href="#cb1-1"></a>SQUIRE TRELAWNEY, Dr. Livesey, and the rest of these gentlemen having</span>
<span id="cb1-2"><a href="#cb1-2"></a>asked me to write down the whole particulars about Treasure Island, from</span>
<span id="cb1-3"><a href="#cb1-3"></a>the beginning to the end, keeping nothing back but the bearings of the</span>
<span id="cb1-4"><a href="#cb1-4"></a>island, and that only because there is still treasure not yet lifted, I</span>
<span id="cb1-5"><a href="#cb1-5"></a>take up my pen in the year of grace 17__ and go back to the time when</span>
<span id="cb1-6"><a href="#cb1-6"></a>my father kept the Admiral Benbow inn and the brown old seaman with the</span>
<span id="cb1-7"><a href="#cb1-7"></a>sabre cut first took up his lodging under our roof.</span></code></pre></div>
</article>
</body>

Can you point me to the right direction? Many thanks!

unexpected "-", expecting letter

The GitHub template cannot be used as it generates a parsing error. System is Ubuntu 16.04 LTS (Xenial), and Pandoc version is 1.16. Full information with following commands:

# Version info
# ------------

grep DESCRIPTION /etc/lsb-release 

#> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

pandoc --version | head -1

#> pandoc 1.16.0.2


# Failure test
# ------------

git clone https://github.com/tajmone/pandoc-goodies.git

cat <<EOF >test.md
# Section 1
This is a Markdown document!

# Section 2
This is section 2
EOF

pandoc -f markdown -t html5 --toc \
    --template pandoc-goodies/templates/html5/github/GitHub.html5 \
    -o test.html test.md

#> pandoc: "template" (line 1, column 2):
#> unexpected "-"
#> expecting letter

I'd understand that the 16.04 system is a bit old (albeit fully supported). However the error also happens in the latest stable version, Ubuntu 18.04 LTS (Bionic):

# Version info
# ------------

grep DESCRIPTION /etc/lsb-release 

#> DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"

pandoc --version | head -1

#> pandoc 1.19.2.4


# Failure test
# ------------

git clone https://github.com/tajmone/pandoc-goodies.git

cat <<EOF >test.md
# Section 1
This is a Markdown document!

# Section 2
This is section 2
EOF

pandoc -f markdown -t html5 --toc \
    --template pandoc-goodies/templates/html5/github/GitHub.html5 \
    -o test.html test.md

#> pandoc: "template" (line 1, column 2):
#> unexpected "-"
#> expecting letter
#> CallStack (from HasCallStack):
#>   error, called at src/Text/Pandoc/Templates.hs:73:35 in pandoc-1.19.2.4-HbfKWUyODESBIy0vGktOwX:Text.Pandoc.Templates

Which means that it's not possible to use the template even with latest stable version of Ubuntu (and by extension I'd say Debian)

Pandoc version requirement?

Seems like the template isn't parsed properly:

> pandoc --template=GitHub.html5 blah.md -o blah.html
pandoc: "template" (line 1, column 2):
unexpected "-"
expecting letter
CallStack (from HasCallStack):
  error, called at src/Text/Pandoc/Templates.hs:185:26 in pandoc-1.17.2-Cq2iGUE9cDsAnk3CjbY7fx:Text.Pandoc.Templates

Running on Debian 9:

> pandoc --version | head -1
pandoc 1.17.2

Template is available locally under /usr/share/pandoc/data/templates/GitHub.html5 and contains:

$--| GitHub HTML5 Pandoc Template" v2.1 | 2018/02/28 | pandoc v2.1.1
<!DOCTYPE html>
<!--
==============================================================================
           "GitHub HTML5 Pandoc Template" v2.1 — by Tristano Ajmone
==============================================================================
Copyright © Tristano Ajmone, 2017, MIT License (MIT). Project's home:
...

Any ideas?

how to use it for convert markdown to html?

I want to know how to use, give a user tutorial. Because I test it, but never get a good html.
My usage is pandoc openapi.md -o openapi.html --css GitHub.css --self-contained. The result is ```
[WARNING] This document format requires a nonempty <title> element.
Please specify either 'title' or 'pagetitle' in the metadata.
Falling back to 'openapi'

How is the underlying of line numbers controlled?

Hi,

Thanks for your really useful guide (I'm referring to pandoc-goodies/tree/master/skylighting-themes). I have a problem I can't seem to be able to address: in every style, the line number is underlined by default. This is done through

a.sourceLine::before {
    text-decoration: underline;
}

in the CCS code produced by the theme I'm using. I can't seem to find a way to change this behaviour. The only two parameters referring to line numbers in the theme files seem to be

    "line-number-color": "#aaaaaa",
    "line-number-background-color": null,

Any idea on how to change this behavior?

Support relative page header links

Relative page links like
https://github.com/tajmone/pandoc-goodies/tree/master/templates/html5/github#primer-css
or
https://github.com/tajmone/pandoc-goodies#gnu-general-public-license
would be awesome.

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.