Hot answers tagged

7

Figured it out myself. Turns out with the latest pandoc and pandoc-crossref you can do this: #+CAPTION: Google NGrams Viewer Searches #+LABEL: fig:ngrams [[file:ngrams.png]] Then: Please refer to [@fig:ngrams].


6

You can also use org-ref. Then you can use ref:ngrams to reference a figure. This works well with LaTeX export. It probably works with pandoc too.


4

The drawers are added only if a header has additional attributes. One can use a simple Lua filter to remove all attributes from headers in pandoc's internal document format: function Header (header) return pandoc.Header(header.level, header.content, pandoc.Attr()) end Write the above to a file named remove-header-attr.lua and call pandoc with the ...


4

I think this is best solved on the level of pandoc conversion, with a pandoc filter. Create a file, say noattrs-filter.hs containing: import Text.Pandoc.JSON main = toJSONFilter noAttrs noAttrs :: Block -> Block noAttrs (Header n _ i) = Header n nullAttr i noAttrs (Div _ b) = Div nullAttr b noAttrs b = b Compile the file with ghc: ghc noattrs-filter....


3

Download the Emacs source from a GNU mirror and unpack it with tar xf. Run makeinfo --docbook doc/emacs/emacs.texi -o emacs.docbook to create an intermediate DocBook. Run pandoc --from docbook --to org --out emacs.org emacs.docbook to create your org file. Note that you really should add the document types explicitly, at least for the input type. Otherwise ...


3

From the solution linked to by ista (direct link to the solution), you can create a pandoc filter, say in file nodivs-filter.hs import Text.Pandoc.JSON main = toJSONFilter nodivs where nodivs (Div _ bs) = bs nodivs b = [b] You then compile the filter with ghc: ghc nodivs-filter.hs. Finally, you use the filter when converting, as follows:...


2

If you don't mind using a shell script to accomplish what you want, you can try: pandoc -t org file.md | sed -E "/^[[:space:]]+:/ d" > file.org This will remove all lines starting with one (or more) spaces followed by a semicolon. I believe you can fit it into your script by doing the following: function pandoc2org () { basename=${1%%.*} ...


2

You can try to implement a function like this: (defun pandoc-md2html () "Compile markdown file to HTML, using pandoc." (interactive) (when buffer-file-name (message "Pandoc markdown to HTML compilation...") (shell-command (concat "pandoc" " -o " (concat (file-name-base) ".html") " " ...


2

That's either a bug or a feature in the ox-gfm package. Basically, the ox-gfm package defines an exporter that derives from the ox-md exporter, which derives from the ox-html exporter. The html exporter states that all timestamps need to be run through the org-html-timestamp function, which is what prints out the span you see. Neither the md or gfm exporter ...


1

[This is a supplement to my other answer: it has very little to do with emacs, but it does address the common question of how to sustainably carry a patch for some upstream component, in the context of an emacs package. If the moderators deem it off-topic, I will delete it or perhaps incorporate it into my other answer, whichever seems most appropriate.] My ...


1

The reason for this is the md export backend is derived from the html backend and does not redefine how time stamps are exported, so it falls back to however the html backend exports time stamps. There are various ways, some more invasive than others, to change that. The least invasive way is probably to define your own specialized backend that is almost md ...


1

Try adding the following to your init.el: (add-hook 'markdown-mode-hook '(lambda () (setq flyspell-generic-check-word-predicate 'my-pandoc-flyspell-verify))) (defun my-pandoc-flyspell-verify () (save-excursion (forward-word -1) (not (looking-back "@")))) Essentially, it is telling flyspell not to check words that start ...


1

This works for me. (defface pandoc-citation-face '((t :foreground "yellow")) "Face for pandoc citation syntax") (font-lock-add-keywords nil '(("\\[@.+?\\]" 0 'pandoc-citation-face)))


1

...only keep what's important to remember... This doesn't answer your question directly, but it suggests some alternatives you might want to consider. If you use library Info+ then you can easily create a virtual manual of nodes you want "save". In Info mode: . (Info-save-current-node) adds the name of the current node to the list value of option Info-...


1

The markdown exported in org is generic: it does not handle the many flavors that are extant. You are probably better off using pandoc to do conversions to markdown: pandoc -r org -w markdown_github foo.org > foo.md You can find what formats pandoc supports with the --list-input-formats and --list-output-formats options.


1

This happens as ox-pandoc tries to work around some of pandoc's missing org-mode features by first exporting via the org-mode org exporter and calling pandoc on the result. The org exporter discards all non-org snippets. I'm not aware of any way to prevent this; calling pandoc directly is probably the only option.


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