Hot answers tagged

36

Org mode 8 no longer accepts LaTeX characters like that. The correct way to do it is embed export snippets in the title: #+TITLE: Foo @@latex:\\@@ Bar I assume therefore that if you want to export newlines in both LaTeX and HTML, the code might have to look like this: #+TITLE: Foo @@latex:\\@@ @@html:<br>@@ Bar Source: https://lists.gnu.org/archive/...


24

My preferred tool for live-editing HTML documents is skewer-mode. It updates the document in the browser without a refresh, so you get instant feedback on your changes. Here's a demo video that shows it in action. It has modes for live-editing HTML, CSS, and JavaScript. It's most useful for JavaScript, as it enables a workflow a lot like hacking on Emacs ...


22

Impatient Mode will get you most of the way there. Here's a cool video. It's especially handy when doing the first styling and prototyping. Since it renders the current buffer, you'll have to put all your html and css in one buffer, code and tweak until you're happy, then separate it all out. Even Javascript can be handled the same way — but it's a bit ...


12

You can use the built-in sgml-mode for this. M-x sgml-mode - Enable the sgml-mode major mode so that sgml-pretty-print command auto-loads. C-x h - Select the whole buffer. M-x sgml-pretty-print To save space, below is only a part of the formatted text that I get on doing the above on your sample text in the question: <table border="4px" cellpadding="0" ...


11

is it feasible to make one? Since this is emacs, yes. My approach is to use a 3rd party tools that can take HTML and convert to plain text or even directly to Org format. I think this is an ugly hack, and there may be better ways to do this, but it looks like it works for my test cases. (defun kdm/html2org-clipboard () "Convert clipboard contents from ...


11

set-goal-column might be what you're looking for : set-goal-column is an interactive compiled Lisp function in `simple.el'. It is bound to C-x C-n. (set-goal-column ARG) Set the current horizontal position as a goal for C-n and C-p. Those commands will move to this position in the line moved to rather than trying to keep the same horizontal position. ...


10

Maybe something like this (tested with LaTeX and HTML) #+TITLE: An Orged Paper #+AUTHOR: Rasmus #+DATE: A Dark Day for Science #+RESULTS: html-header #+begin_abstract #+begin_center {{{html-only(*Abstract*)}}} #+end_center my long abstract that is longer than one line. my long abstract that is longer than one line. #+end_abstract #+toc: headlines * ...


10

First, I believe org can use htmlize to automatically color your source code blocks according to your theme. Alternatively. Check out http://definitelyaplug.b0.cx/post/custom-inlined-css-in-org-mode-html-export/. It has a great example of how to use the org-export-before-processing-hook to throw custom css onto an org document before an html export. Here'...


10

Alternatively to query replace you can go with multiple-cursors: Also consider using something like this: (defun wrap-html-tag (tagName) "Add a tag to beginning and ending of current word or text selection." (interactive "sEnter tag name: ") (let (p1 p2 inputText) (if (use-region-p) (progn (setq p1 (region-beginning) ) ...


10

What you are looking for is org-info.js, a JavaScript library to be used in conjunction with HTML files generated from Org. This library adds support for folding, navigation, etc. Take a look at http://orgmode.org/manual/JavaScript-support.html, and the more detailed documentation here: http://orgmode.org/worg/code/org-info-js/.


10

This is a known issue and as of now, it has not been fixed. I've decided to forego jsx-mode for this reason and just use web-mode. It has support for JSX and is better suited for mixed content files. Since I do work in several projects that don't all have the same convention of using the .jsx ending for JSX files (some simply use .js endings), I've also ...


9

You can use query-replace-regexp (C-M-%). Replace ^\(.*\)$ with <li>\1</li>.


9

You can get this result by setting the CUSTOM_ID property. From the following file: * Test :PROPERTIES: :CREATED: [2014-10-02 Thu 11:48] :END: ** Sub no custom :PROPERTIES: :CREATED: [2014-10-02 Thu 11:49] :END: ** Sub custom :PROPERTIES: :CREATED: [2014-10-02 Thu 11:49] :CUSTOM_ID: Custom :END: I get the following Export (C-c C-e h H): <div id="...


9

If you want to include literal HTML in your org file, and have it exported only when you export to HTML, use an export block: #+BEGIN_EXPORT html <br> <h2>This is the footer.</h2> <p>You can put stuff here.</p> <br> #+END_EXPORT You cannot use #+INCLUDE inside an export block though (well, you can, but it won't work the ...


8

Org is extremely versatile when it comes to defining links, so they're probably your best bet. For that you need the org-add-link-type function. (org-add-link-type "audio" #'ignore #'endless/export-audio-link) The second argument is telling org you don't care about opening audio links for now, and the third argument says how to export them to html. Use the ...


8

FYI for anyone else who comes across this issue, this is because this jsx-mode project is not made to edit Facebook's React JSX templates but rather this other compiled javascript language also called JSX. That having the same name as the React templates is entirely coincidental. This is why the first commits to this repo were 4 years (pre-dating Facebook'...


7

The most direct way of doing this would be to Mark the region of text lines to become a list Press M-% (query-replace) Type C-q C-j RET </li> C-q C-j <li> RET (C-q C-j inserts a quoted newline character) Press ! to replace all occurrences


7

Emacs includes a pure-Elisp XML parser in xml.el, whose xml-parse-string function does the job, though it seems a bit like an undocumented internal function. I'm not sure if there are any HTML-only entities which won't be properly handled by treating the string as an XML fragment. This wrapper function will simply omit any trailing tags from the input ...


7

After a while, I found the answer myself: In a nutshell: Use a combination of Eww and markdown mode, and configure markdown mode to render markdown with pandoc. Alas, easier said than done. Update to Emacs 24.5 Eww is the built-in browser since Emacs 24.5 It can be used to display html output. Eww does not run out of the box in Emacs 24.5 for windows. The ...


7

With the default HTML mode as of Emacs 24.4, you can get the same behavior as Sublime Text (automatic insertion of the closing tag if you type </) by putting the following line in your init file: (setq sgml-quick-keys 'close) Out of the box, pressing C-c / or C-c C-e or C-c / inserts a closing tag (the whole </foo>). You can find out about these ...


5

You can get Emacs to show you a stack trace when the function is called, so that you can figure out what called it. M-x debug-on-entry RET auto-fill-mode RET trigger the issue Check the stack trace. Depending on the details, the exact cause may not be 100% clear, but it should certainly give you a good idea of where to look next. Use c to continue execution ...


5

You could write a minor mode that refreshes the rendered webpage after you modify any relevant buffer. Of course, doing so after each keystroke would be overkill, so using a timer and rendering when emacs is idling A quick POC would be: (defvar my-html-render-delay 1) (defun my-html-render-post-command-hook () (run-with-idle-timer my-html-render-delay ...


5

I guess the simplest way is to define a macro in your orgmode file with: #+MACRO: abbr @@html:<abbr title="$1">$2</abbr>@@ You can then add an abbr in your text with: {{{abbr(Definition, abbreviation)}}} Edit: This is probably the better solution: Add a special tag for abbr: (defun org-export-abbr (backend) "Replace {abbreviation|...


5

The string behind :: is actually a search. In this context one understands the relevant comment in the source code of the function org-html-link in the library file ox-html.el (org 8.2.5). It says: ;; Add search option, if any. A search option can be ;; relative to a custom-id or a headline title. Any other ;; option is ignored. So, you can either ...


4

Tagedit is what you want. From the README: tagedit-forward-slurp-tag moves the next sibling into this tag. tagedit-forward-barf-tag moves the last child out of this tag. tagedit-raise-tag replaces the parent tag with this tag. tagedit-splice-tag replaces the parent tag with its contents. tagedit-join-tags combines two tags into one, prompting for tagname ...


4

You can hide the title by providing the appropriate CSS setting. For example, add this line to your file (and hit C-c C-c to activate the change): #+HTML_HEAD: <style type="text/css"> <!--/*--><![CDATA[/*><!--*/ .title { display: none; } /*]]>*/--> </style> or set the org-html-head variable. Here's the documentation.


4

You can achieve your desired result with a macro like this (which should also work for latex, but without the url): #+MACRO: quote @@html:<q cite="$2">$1</q>@@@@latex:``$1''@@ And then there is: {{{quote(The nice thing about standards is that there are so many to choose from,http://searchservervirtualization.techtarget.com/definition/Our-...


3

As far as I know the only solution is to adjust the settings in Firefox: Enter about:config in your address bar, confirm and search for browser.link.open_newwindow.override.external and set it to 1. After that it should work like you want.


3

I'm not entirely sure there wouldn't be any unwanted side effects, but the following might work (push (cons "\\\\\\\\" "<br />") org-html-special-string-regexps) Kinda lucky that the list of special string expansions is extensible in the HTML exporter, because it's not in the LaTeX exporter...


3

This post describes you can alter existing markup to produce any kind of tag you want. I'm not aware of any way of defining new markup with this, but, since ~ and = are redundant when exporting to html, you can change one of the two while still using the other as <code>. The following snippet should turn ~sabai.mp3~ into <audio src="sabai.mp3">&...


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