Hot answers tagged

6

@glucas's answer is correct in its diagnosis, but has a minor problem (you want the 0th element of argv) and is incomplete. Here is a more complete example: #!/usr/bin/env -S emacs --script (find-file (nth 0 argv)) (mhtml-mode) (indent-region (point-min) (point-max) nil) (save-buffer) This does not use web-mode which is not available to me (does it exist?);...


3

I believe your example is not loading the file specified on the command line. It looks like with --script you need to get the file name from the command-line arguments passed to emacs and open that file before you try to process it. Something like: (find-file (nth 1 argv)) (web-mode) ;; etc


2

It depends on what you want to do with the tables of course, but assuming that you want to produce generic Org mode tables that can be exported in the standard way, you will have to make the python block produce the structure that Org Babel expects in order to produce the generic Org mode table. That structure is a list of lists: first a list for the headers,...


2

Here is my (maybe somewhat hacky) fix. Put this in your config file. (with-eval-after-load 'ox-html (setq org-html-head (replace-regexp-in-string ".org-svg { width: 90%; }" ".org-svg { width: auto; }" org-html-style-default))) How did I came up with this? Reading the org-mode manual's section about ...


2

I would continue using the macro. You can use markup inside the macro that expands differently for HTML export than it does for PDF export. For example, as a first approximation, this will allow you to get the dates in the HTML output, although they are not nicely formatted - but it's a beginning: #+MACRO: date @@latex: \hfill\normalfont{\small $1} @@ @@...


2

Put this in $HOME/.emacs.d/init.el and start up emacs: (setq inhibit-startup-screen t) (eww-open-file "/path/to/startup.html") If you want to visit a URL instead, just replace the second line with (eww "https://example.com/index.html")


2

You can use notmuch-show-view-part (bound to .-v by default) while point is in the text/html part to accomplish this. For this to function properly you'll need to make sure your ~/.mailcap file has settings for text/html. Here's what I have in mine on my Mac: text/html; open %s; nametemplate=%s.html Each line is ; delimited with the first field specifying ...


2

As an alternative, you can use the ox-pandoc package. Pandoc itself has a command line option called --self-contained which will embed images in html. To you use this for just the pandoc HTML5 exporter, by putting this in your .emacs: (setq org-pandoc-options-for-html5 '((standalone . t) (self-contained . t))) Also, you could have it for html4 instead/as ...


2

Something like this perhaps - I've written the code block in python but you can do it in any language you want: * foo blah blah blah #+begin_src python :results output :exports results :var n=700 :wrap export html for i in range(1,n+1): print('<figure>\n <img src="./images/image{}.png" width="300px" />\n</...


2

In addition to the answer of Melioratus which I accepted, I also noticed that I can embed native HTML code in the title via the inline HTML mechanism of org mode. So for instance, this also works and allows me to add extra attributes like width and height. #+TITLE: @@html:<img src="file:///home/pictures/bird.svg" alt="" / width="...


1

Write a modified org-html-format-headline-function that calls a modified org-html--tags function and hook it into the standard HTML exporter by redefining/customizing the variable org-html-format-headline-function. Here's a possible implementation: #+begin_src elisp (defun ndk/org-html-format-headline-function (todo _todo-type priority text tags info)...


1

nxml-mode, which implicitly loads the built-in sgml-mode for a small number of things, is loaded before PSGML. This means a number of names get clobbered before PSGML loads and it can’t properly claim them. Loading PSGML before nxml-mode fixes the problem since Emacs will think sgml-mode is already there when nxml-mode loads, but nxml-mode will no longer ...


1

C-c C-v C-t runs org-babel-tangle and exports all code blocks to the current buffer name plus the correct code extension (e.g. html blocks get .html, python blocks get .py). You can specify the tangled filename with the :tangle property at the header, section, or file level. Run C-u C-c C-v C-t to only tangle the current code block containing the point.


1

Add file:some-directory/image1.png into #+TITLE: I use this technique for exporting to HTML and for rendering org-mode pages in GitLab. e.g. #+TITLE: file:some-directory/image1.png My Long Title Preceded by Many Spaces which exports to html <title><img src="some-directory/image1.png" alt="image1.png"> ...


1

It's done with a Javascript library called org-info.js, written by Sebastian Rose. See the Javascript support section of the Org mode manual. There is also some additional documentation in Worg.


1

There is no such hook, but you can write a function that does what you want and execute that instead: (defun ndk/org-export-to-html-and-rsync () (interactive) (org-export-as 'html) (rsync-html)) You can even bind to a key so that you can execute it easily: (define-key org-mode-map (kbd "C-c z") #'ndk/org-export-to-html-and-rsync) Notes: ...


1

I often need to link to the emacs manuals, for example, this markdown link: (emacs) Echo Area, is created via M-x chunyang-Info-markdown-current-node-html since it's difficult to do it manually. With the following, you can also type O to open the corresponding HTML manuals in your web browser. (defvar chunyang-Info-html-alist '( ;; Special cases come ...


1

To disable that globally, you can use (set org-export-time-stamp-file nil).


Only top voted, non community-wiki answers of a minimum length are eligible