Code Monkey home page Code Monkey logo

engrave-faces's Introduction

Engrave Faces

GNU ELPA GNU-devel ELPA

There are some great packages for Exporting buffers to particular formats, but each one seems to reinvent the core mechanism of processing the font-lock in a buffer such that it can be exported to a particular format.

This package aims to produce a versatile generic core which can process a fontified buffer and elegantly pass the data to any number of backends which can deal with specific output formats.

This is very much a work in progress, a rough plan can be seen below. I fully expect some important items to have been forgotten.

Font lock processing

  • [X] Single faces
  • [X] Merge multiple faces
  • [ ] Process overlays

Included backends

  • [X] LaTeX
  • [X] HTML
  • [X] ANSI

engrave-faces's People

Contributors

elken avatar tecosaur 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

Watchers

 avatar  avatar  avatar  avatar  avatar

engrave-faces's Issues

Compiler warnings

In engrave-faces-define-backend:
engrave-faces.el:79:11: Warning: docstring wider than 80 characters

In engrave-faces-buffer:
engrave-faces.el:134:48: Warning: Unused lexical variable `engrave-faces-current-preset-style'
engrave-faces.el:139:12: Warning: reference to free variable ‘engrave-faces-current-preset-style’

In engrave-faces-attribute-values:
engrave-faces.el:225:55: Warning: reference to free variable ‘engrave-faces-current-preset-style’
engrave-faces.el:338:1: Warning: Variable ‘engrave-faces-current-preset-style’ declared after its first use

`org-latex-engraved-theme` does not impact syntax highlighting

Description of issue

Setting org-latex-engraved-theme to t seems to only impact the background colour of exported code blocks in pdf, and the syntax highlighting remains the default colour. However, specifying:

#+attr_latex: :engraved-theme THEME

above a specific code block causes it to be correctly highlighted.

setting #+latex_engraved_theme: THEME in the file does not cause syntax highlighting to occur.

Screenshots

  • Appearance of source code in buffer
    image

  • The way it's rendered normally

image

  • Appearance of export with specifying the properties

image

Config

I'm using Doom Emacs, here's my relevant config

  • engrave-faces:
(use-package! engrave-faces-latex
  :after ox-latex
  :config
  (add-to-list 'org-latex-engraved-options '("linenos" "true"))
  (setq org-latex-engraved-theme "t")
  )
  • general org config
  (setq org-latex-src-block-backend 'engraved)

Colour specification for textbox assumes colour in form #AABBCC

If you have specified the foreground colour for a face using a name, e.g. "DarkSlateBlue", the LaTeX code produced uses "arkSlateBlue" as the colour which of course does not exist. The code assumes that there is a # at the start of the colour specification.
I am happy to use hex strings for colours but a heads up in the documentation would be welcome!
Otherwise, this package is excellent and makes code listings look very nice in both LaTeX and HTML documents when exporting from org mode. Thank you.

Feature request: line numbers

This package works very well and solves very nicely a problem I was having using listings and minted which is exporting code in languages not known by either of those packages. However, I really miss being able to have each line labelled with a line number. Please consider this as a possible future feature. Thank you.

Update: the Verbatim environment from fvextra allows for the numbers=left (for instance) option so it's just a matter of allowing this option to be set?

Further update: it is org mode that I need to be looking at and in fact it allows for options. Please ignore this issue! Thank you and sorry for the noise.

Not working with doom-nord theme

Hi, I'm using this package to color the syntax for my exports. However, it seems like using the doom-nord theme results in weird colors:
image
Other themes, like doom-vibrant or doom-one-light work just fine
image
Any idea what could be happening?

"Theme ‘ ’ is not found" when running engrave-faces-html-buffer-standalone

When running engrave-faces-html-buffer-standalone or engrave-faces-html-file, I get:

user-error: Theme ‘      ’ is not found in ‘engrave-faces-current-preset-style’ or availible Emacs themes.

Is there some setup I need to perform first?

Init file for reproducing (start Emacs with emacs -Q -l init.el):

;; contents of init.el
(setq
  package-enable-at-startup nil
  straight-base-dir (file-name-directory load-file-name))

(defvar bootstrap-version)
(let ((bootstrap-file
      (expand-file-name "straight/repos/straight.el/bootstrap.el" straight-base-dir))
      (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package
  '(engrave-faces :type git :host github :repo "tecosaur/engrave-faces"))

Then create test.py and type some Python code into it:

def foo():
    pass

Then run engrave-faces-html-buffer-standalone or engrave-faces-html-file. The error should appear.

Modifing text in latex exported document

Hello, I'm having some issues when exporting to latex, sometimes the exported document has extra characters in some lines.
image

Also, some text is added to the beginning of the document.
image

This text depends on the theme used, this is the output using the doom-nord-light theme (the previous screenshots used the doom-acario-light theme).
image

Do I have missing dependencies?

My build is GNU Emacs 29.0.91 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-06-01.

My export setup is:

(setq org-latex-pdf-process
'("latexmk -shell-escape -pdf -quiet -f -%latex -interaction=nonstopmode -output-directory=%o %f"))

engrave region

Is it somehow possible to export only a region of the current buffer like in htmlize? And is it possible to prevent engrave-faces from creating a new temporary buffer/using a new mode (I would like to use engrave-faces in agda2-mode, not in org-mode).

Support/add more special faces for exporting

First of all: Thats more of a question than a real issue with the code. But since I couldn't find any concrete instruction how to add a theme or just some custom faces to engrave-faces and my elisp knowledge is still very limited (switched to emacs only few weeks ago), I hope to find a solution here from you guys who created the whole thing. If that's inappropriate here on a GitHub issue page, just close/remove my comment; I would understand.

I recently switched to engrave-faces because I like the style and approach of it. Since I'm using org-mode a lot to work on documentation on latex-programming and latex-based publishing, I've a lot of latex code inside my source blocks. Many of those code snippets contain latex3 macros which are not very well supported by emacs/AUCTeXs standard code highlighting.

The latex3 macros are highlighted with the font-latex-sedate-face. If I now export my org-file to latex through pdf, the respective code snippets are highlighted in the same color like in the emacs buffer since engrave-faces seems to copy the HTML color-code to the intermediate latex file. Unfortunately, this color doesn't fit well with the default colors for keywords, strings etc. wich are defined in engrave-faces-themes.

How is it possible to add a custom color processing to the engrave-faces-themes resp. engrave-faces-current-preset-style variable, e.g. (font-latex-sedate-face :short "fl-sedate" :slug "sed" :foreground "#ff8c00"), which makes it possible to define an own color for exporting? I tried adding a complete new theme (copied everything from 'default theme) to the engrave-faces-themes list with something like (add-to-list 'engrave-faces-themes '(test-ltx-face . [...] many lines of color processing values [...] (font-latex-sedate-face :short "fl-sedate" :slug "sed" :foreground "#ff8c00") [...] and load it with #+latex_engraved_theme: test-ltx-face from my org-file. But it doesn't work out. The result is the error message from engrave-faces-get-theme: Theme test-ltx-face is not found in `engrave-faces-current-preset-style' or availible Emacs themes.

Not handling color names correctly.

I've been debugging for hours trying to figure out why org latex export doesn't not fully compile and fail and it turns out engrave-faces does not handle hex and color names correctly when exporting to latex.
i have the following source block that contains something like.
image
Anything before line will be compiled and not after it

 (doom-blend 'orange 'green size-index)
 (doom-blend 'red 'orange (- size-index 1)

exporting to latex will result into something like this.
image

Also hex colors are not correctly set.
image
image

Update: Tried this PR and it fixed the issue 360cbc0

Does not work? Need setup instructions

This looks nice, how do you set it up? In my config:

(use-package engrave-faces
    :load-path "~/.emacs.d/engrave-faces"
    :config
    (setq org-latex-listings 'engraved))

But src blocks aren't highlighted on latex export.

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.