Giter Club home page Giter Club logo

imagify's People

Contributors

jdutant avatar

Stargazers

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

Watchers

 avatar

Forkers

connortwiegand

imagify's Issues

Quarto: in LaTeX/PDF output, pass packages using the Lua API

In Quarto users shouldn't specify LaTeX packages as (LaTeX commands in) header-includes. They should put them under the imagify key.

  • Metadata syntax: make sure users can use the same keys under imagify as under format: pdf:
  • Metadata coverage: make sure we pick up all documented Quarto keys that are relevant for the filter (provided we can access them when rendering to other formats than PDF)
  • Pass to PDF output: pass packages specified under imagify to LaTeX when targeting LaTeX or PDF. In Pandoc, generate raw header-includes. In Quarto, use quarto.doc.include_text('in-header', text) and quarto.doc.use_latex_package(pkg, opt). See Quarto Lua API.

Quarto: use native base64 encoding

To embed SVG files in data URLs the filter use base64url encoding. In Quarto the lbase64 library is available, the filter should use it.

  • Check whether the default encoding is URL-safe
  • If not, create a decoder (on-demand, in case the filter is applied to a doc without imagified content)

Add support for `revealjs`

When I imagify a simple tex command in Quarto with format: html, things work as expected. However, when I change the format to revealjs, I get a 404 error that the file cannot be found (even though an absolute link is provided to the existing file). Note that I am creating this issue with a PR ready, but I'm not entirely sure if this will add the full generality of the filter to all reveal presentations.

Great filter BTW!

Parsing macros to imagify

First of all, many thanks for this extension!

I am trying to use a macro and a tikzstyle in a TikZ picture but they both seem to fail:

  1. \newcommand{\env}{\mathcal{E}}
  2. \tikzstyle{arrow} = [->, > = Latex, very thick]

I am going to show the problem with tikzstyle only as I suspect the problems to be similar.


Here is the code that works (provided imagify is installed of course):
test_work.qmd:

---
title: "Test"
lang: en-GB
pdf-engine: lualatex
filters:
  - imagify
imagify:
  header-includes: |
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \usetikzlibrary{arrows.meta}
  pdf-engine: lualatex
format:
  html:
    toc: true
  pdf:
    include-in-header:
      - text: |
          \usepackage{tikz}
          \usetikzlibrary{positioning}
          \usetikzlibrary{arrows.meta}
---

![A test](./testFig_work.tex){#fig-testFig}

testFig_work.tex:

\begin{tikzpicture}
	%% Define nodes
	\node (N0) at (0, 0) {N0};
	\node[right = of N0] (N1) {N1};

	\draw[->, > = Latex, very thick] (N0) -- (N1);
\end{tikzpicture}

Here is the code that does not work:
test_fail.qmd:

---
title: "Test"
lang: en-GB
pdf-engine: lualatex
filters:
  - imagify
imagify:
  header-includes: |
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \usetikzlibrary{arrows.meta}
    \tikzstyle{arrow} = [->, > = Latex, very thick]
  pdf-engine: lualatex
format:
  html:
    toc: true
  pdf:
    include-in-header:
      - text: |
          \usepackage{tikz}
          \usetikzlibrary{positioning}
          \usetikzlibrary{arrows.meta}
          \tikzstyle{arrow} = [->, > = Latex, very thick]
---

![A test](./testFig_fail.tex){#fig-testFig}

testFig_fail.tex:

\begin{tikzpicture}
	%% Define nodes
	\node (N0) at (0, 0) {N0};
	\node[right = of N0] (N1) {N1};

	\draw[arrow] (N0) -- (N1);
\end{tikzpicture}

I gathered in a zip the four files.

I am doing anything wrong or is there a bug in transmitting the macros and tikzstyle?
test.zip

Embed should be deactivated when extract-media is on

Deactivate embedding when extract-media is on.

This is due to a bug in Pandoc: instead of leaving data URLs as they are, it treats them as links to non-existent media files that it tries to extract, and converts the data URLs into link URL to non-existent files.

Quarto: clean metadata after processing

From this discussion:

The filter looks for them both at the root and under imagify (the latter overriding the former). Seems fine?

Yes - It seems fine to me to use same name key as default Pandoc. What I am suggesting is doing some special treatment in Lua and not just passing them through to override. This way I think you could catch a raw content in LaTeX that would be removed in HTML output and use it for your HTML processing.

In Quarto, perhaps in Pandoc, consider whether some Imagifying/LaTeX metadata picked up by the filter should be removed in non-LaTeX/PDF output. E.g. LaTeX options at the root and the like.

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.