0

I'm writing an exporter for Remarkup: https://github.com/renatgalimov/org-phabricator.

It's similar to Markdown and based on org-md which itself is a modification of ox-html.

Whenever I export, some Unicode sequences get replaced by &something; HTML escape sequences, which is not necessary for remarkup.

I'm struggling to find, which function or setting I need to modify to skip the escaping.

Example:

   | ITEM                                | FOLLOW_CONFIG |
   |-------------------------------------+---------------|
   | \_  Enforcing particular resolution |               |
   | \_    No hotplug                    |               |
   | \_      HDMI mode auto              |               |

Result:

<table>

<tr>
<th>ITEM</th>
<th>FOLLOW<sub>CONFIG</sub></th>
</tr>


<tr>
<td>&ensp;&ensp;Enforcing particular resolution</td>
<td>&#xa0;</td>
</tr>


<tr>
<td>&ensp;&ensp;&ensp;&ensp;No hotplug</td>
<td>&#xa0;</td>
</tr>


<tr>
<td>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;HDMI mode auto</td>
<td>&#xa0;</td>
</tr>

</table>

I want to put (en-space) instead of &ensp;s.

Thanks

3
  • Do they hurt anything? After all, you asked for these spaces: if you don't want them, why add \_ ?
    – NickD
    Sep 21, 2021 at 11:54
  • Remarkup can render en spaces without quoting. I want them to be there, but I don't want them to be replaced with &ensp;
    – Renat
    Sep 22, 2021 at 5:34
  • The translation is done through the org-entities variable, but (partly because I don't know anything about remarkup) I don't really understand your workflow. Maybe the thing to do is to write a derived exporter (derived from the HTML exporter) where you somehow override the org-entities settings?
    – NickD
    Sep 22, 2021 at 14:02

1 Answer 1

2

If you don't need any entitites, then you can customize (i.e. include/exclude) the export of entities via the org-export-with-entities variable.

To set the variable per buffer, you can include the OPTIONS keyword with the value e:nil at the beginning of your file/buffer.

#+OPTIONS: e:nil

source: https://orgmode.org/manual/Export-Settings.html (and the variable its docstring)

To exclude the \_ entitites specifically, you can override their values with the org-entities-user variable, e.g. as follows:

(customize-set-value 'org-entities-user
                     (let (space-entities html-spaces (entity "_"))
                       (dolist (n (number-sequence 1 20) (nreverse space-entities))
                         (let ((spaces (make-string n ?\s)))
                             (push (list (setq entity (concat entity " "))
                                           (format "\\hspace*{%sem}" (* n .5))
                                           nil
                                           (setq html-spaces (concat " " html-spaces))
                                           spaces
                                           spaces
                                           (make-string n ?\x2002))
                                   space-entities)))))

(code taken from org-entities value and replaced &ensp by a single space)

1
  • 1
    Thanks a lot, that's exactly what I was searching for.
    – Renat
    Sep 24, 2021 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.