Git Product home page Git Product logo

diagrams-pandoc's Introduction

Build Status

diagrams is a full-featured framework and domain-specific language (embedded in Haskell) for creating declarative vector graphics and animations.

This package is just a convenient wrapper around the diagrams-core, diagrams-lib, diagrams-svg, and diagrams-contrib packages, so they can be installed with a single cabal install --lib diagrams command.

The package also comes with flags to enable six different backends. The native SVG backend is enabled by the -fsvg flag and is enabled by default. If you don't want it, you must explicitly disable it with -f-svg.

The native postscript backend is disabled by default but can be enabled by the -fps flag.

The cairo backend is disabled by default but can be selected with the -fcairo flag. In addition, the GTK backend is based on the cairo backend (but split into a separate package to make installing the cairo backend easier). It can be selected with the fgtk flag.

The native rasterific backend which is disabled by default but can be selected with the -frasterific flag.

The native canvas backend which is disabled by default but can be selected with the -fcanvas flag.

Installation

cabal update && cabal install --lib diagrams

or, to get the postscript backend in addition to the SVG backend:

cabal update && cabal install --lib -fps diagrams

or, to get the cairo backend in addition to the SVG backend:

cabal update && cabal install gtk2hs-buildtools && cabal install --lib -fcairo diagrams

Reporting bugs

Issue trackers for all diagrams-related repositories are hosted under the diagrams organization on github. If you know the specific package containing the bug, report it in the issue tracker specific to that package (for example, diagrams-lib). Otherwise, just report the issue in the issue tracker for the general diagrams repository.

Further reading

For more information, including a gallery of examples, tutorial, and user manual, see the diagrams website. For help, join the #diagrams IRC channel on Freenode or the mailing list.

diagrams-pandoc's People

Contributors

bergey avatar byorgey avatar ccrusius avatar cdupont avatar chris-martin avatar iot-icore avatar ozkutuk avatar taqenoqo avatar vmandela 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diagrams-pandoc's Issues

Allow -o to specify a directory hierarchy

In my application, the directory I need to specify with -o is two levels deep, and none of them exists when I call the filter. It would be nice if -o could behave as mkdir -p

Upload new version to hackage

The diagrams-pandoc version on hackage was last updated in 2016, and uses base<4.9 as a bound. These constraints seem to have been relaxed in the repo so I wondered if it is possible to upload a new version to hackage?

Absolute path in image tag

Hi,
I've integrated diagrams-pandoc with my blog. Thanks!
I have one problem with the images generated:

  • images generated are written in outDir, for example "images" in the local directory.
  • HTML code generated contains a pointer to the picture, like so:
    <img src="images/bbb63a1006746c4a.png" />

The problem is that the HTML page generated is not necessarily in the web root directory.
So the code generated should be:

<img src="/images/bbb63a1006746c4a.png" />

or

<img src="../../../images/bbb63a1006746c4a.png" />

The image could also be encoded as image data URI.

For the moment I added a boolean field "pathSeparator" in Opts.
I add a slash to the image name in function insertDiagrams:

if (_absolutePath opts) then pathSeparator : imgName else imgName

If you like this solution I can make a pull request.

Test fails on diagrams-1.4

pandoc -t html demo.md --filter diagrams-pandoc -o demo.html -s

gives following error message:

Error while interpreting

example = square 1
<interactive>:2:1:
    Couldn't match expected type ‘V2’
                with actual type ‘V (IO (QDiagram Cairo V2 Double Any))’
    In the expression: example
    In an equation for ‘e_1’: e_1 = example
    In the expression:
        (let e_1 = example in e_1) :: IO (QDiagram Cairo V2 Double Any)

with demo.md containing:

Here is a square :
''' {.diagram}
example = square 1
'''

Use following package versions:

  • diagrams-1.4
  • diagrams-builder-0.7.2.4
  • diagrams-cairo-1.3.1.1
  • diagrams-contrib-1.4.0.1
  • diagrams-core-1.3.0.8
  • diagrams-core-1.4
  • diagrams-lib-1.3.1.4-
  • diagrams-lib-1.4.1
  • diagrams-pandoc-0.2
  • diagrams-solve-0.1.0.1
  • diagrams-svg-1.4.1

Error When Running Tests

When attempting to install via stack I get:

$ stack install diagrams-pandoc
Run from outside a project, using implicit global project config
Using resolver: lts-7.1 from implicit global project's config file: /home/noah/.stack/global-project/stack.yaml

While constructing the build plan, the following exceptions were encountered:

In the dependencies for diagrams-pandoc-0.3:
    base-4.9.0.0 must match >=4.6 && <4.9 (latest applicable is 4.8.2.0)

Plan construction failed.

I assumed this was because my global system is using lts-7.1 and the master branch is using lts-6.27?

So I attempted to build from source and install using (633e984 - the current master branch). The build and install are successful, however, when attempting to run the tests (or run pandoc on my own documents) I get the following:

$ ./tests.sh 
diagrams-pandoc: Error in $: expected product (:*:), encountered Object
pandoc: Error running filter diagrams-pandoc
Filter returned error status 1
diagrams-pandoc: Error in $: expected product (:*:), encountered Object
pandoc: Error running filter diagrams-pandoc
Filter returned error status 1
diagrams-pandoc: Error in $: expected product (:*:), encountered Object
pandoc: Error running filter diagrams-pandoc
Filter returned error status 1
diagrams-pandoc: Error in $: expected product (:*:), encountered Object
pandoc: Error in $: not enough input
CallStack (from HasCallStack):
  error, called at src/Text/Pandoc/Error.hs:55:28 in pandoc-1.19.1-HDh8ZKvpT93Gt9RE90RMCo:Text.Pandoc.Error

Any ideas of what I can do?

Couldn't match expected type ‘V2’

I have this error:

Error while interpreting
example = square 1
<interactive>:2:1:
    Couldn't match expected type ‘V2’
                with actual type ‘V (IO (QDiagram Cairo V2 Double Any))’
    In the expression: example
    In an equation for ‘e_1’: e_1 = example
    In the expression:
        (let e_1 = example in e_1) :: IO (QDiagram Cairo V2 Double Any)

While trying to run the tests of diagrams-pandoc:

$ cd test
$ stack exec ./tests.sh 

Allow the specification of an output size

In my setup I have to create many diagrams, each with a different size. It would be nice to be able to specify that from the diagram code itself somehow. A command-line switch would not help, because there are many diagrams in a single markdown document, and each needs a different size.

modules not found when installed via Nix

Hi,
when trying to run the example, I get:

Error while interpreting
example = circle 1
/tmp/Diagram1804289383846930886.hs:4:8:
    Could not find module ‘Diagrams.Prelude’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:5:8:
    Could not find module ‘Diagrams.TwoD.Types’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:6:8:
    Could not find module ‘Diagrams.Core.Points’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:7:8:
    Could not find module ‘Diagrams.Backend.Cairo’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:8:8:
    Could not find module ‘Diagrams.Backend.Cairo.Internal’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:9:8:
    Could not find module ‘Graphics.SVGFonts’
    Use -v to see a list of the files searched for.

whereas when I run ghci manually, I can import Diagrams.Prelude without any problem.

(I installed GHC, pandoc and diagrams-pandoc through Nix, but as I said, ghci has no problem finding the required modules)

Issue with base dependency when installing

I've no experience with Haskell, Cabal etc. This is the error I get when trying to install on macOS 11:

$ cabal install diagrams-pandoc         

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: diagrams-pandoc-0.3.1 (user goal)
[__1] trying: svg-builder-0.1.1 (dependency of diagrams-pandoc)
[__2] next goal: base (dependency of diagrams-pandoc)
[__2] rejecting: base-4.14.0.0/installed-4.14.0.0 (conflict: svg-builder =>
base>=4.5 && <4.14)
[__2] skipping: base-4.14.0.0 (has the same characteristics that caused the
previous version to fail: excluded by constraint '>=4.5 && <4.14' from
'svg-builder')
[__2] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
[__2] fail (backjumping, conflict set: base, diagrams-pandoc, svg-builder)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, diagrams-pandoc, svg-builder```

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.