balddotcat / ox-slimhtml Goto Github PK
View Code? Open in Web Editor NEWa minimalist HTML org-export backend
a minimalist HTML org-export backend
Spinning this out to its own issue from #7.
ox-html checks if a link is the only content for a paragraph, and if so checks if the link's file extension matches in a customizable list, to determine whether or not to emit an <img>
tag into the exported HTML. If the paragraph has a #+CAPTION
keyword it will use the caption value as well. ox-slimhtml should be able to emit images as well, although with simpler HTML than ox-html emits. There is also support for #+ATTR_HTML
to explicitly set attributes on the <img>
tag.
As an example, org-mode versus ox-html output, as well as what ox-slimhtml currently emits:
#+CAPTION: This is the image caption.
#+ATTR_HTML: :width 300
[[http://example.com/picture.png]]
ox-html:
<figure id="orgfffffff">
<img src="http://example.com/picture.png" alt="picture.png" width="300">
<figcaption><span class="figure-number">Figure 1: </span>This is the image caption.</figcaption>
</figure>
ox-slimhtml:
<p><em>//example.com/picture.png</em>
</p>
Since <img>
is an inline tag, despite being only supported as block-level content by Org, we should probably wrap the emitted image tag within a block such as a <div>
or <p>
tag, even if we don't support captions.
I've been hand-modifying ox-slimhtml's output so that the example above would become like this:
<p><img src="https://example.com/picture.png" alt="This is the image caption."/><br/>
<em>This is the image caption</em>
</p>
Open questions:
org-html-inline-image-rules
or hard-coded extension list? (By default, the rules only match for file, http, https schemes for GIF, JPEG, PNG, and SVG files.)alt
attribute be set to? (ox-html defaults to the base filename unless explicitly overridden by #+ATTR_HTML
)I'm not sure if this is a problem with my config. Can you provide an example of loading ox-slimhtml into your Emacs?
For some reason, if (load ox-slimhtml)
is a part of my config, it does not load the package properly. If I go and run this command manually, it works.
Currently, link objects with a non-nil link property but with nil contents are exported as the link (without schema/type) wrapped in <em>
tags. Instead, slimhtml should do the same as the default HTML export backend, and generate a proper anchor tag with the raw link value as the anchor text.
[[https://example.com/test.html]]
Current output:
<em>example.com/test.html</em>
Expected output:
<a href="https://example.com/test.html">https://example.com/test.html</a>
Emit org quote blocks as HTML <blockquote>
elements.
Hi @balddotcat ,
I'm using your light html export for a project, so first thank you for this work !
As i see, i don't found footnote support (:with-footnotes
), very common in academic website.
Same with option org-html-footnotes-section
I also try this :
(org-export-define-derived-backend 'ox-slimhtml-publish-to-html 'slimhtml
:translate-alist '((bold . ox-slimhtml-bold)
(footnote-definition . org-html-footnote-definition)
(footnote-reference . org-html-footnote-reference)
(special-block . org-html-special-block)))
Could you please add some paragraph of documentation to explain how users could expand ox-slimhtml to reinject ox-html missing part, like footnotes ?
Thanks,
Hi, I started depending on your nice library, and use org-export-string-as
to convert an org entries' headings and contents from string to html here and here (the front
is just org entry's heading, and the back
is all possible org-mode elements until the next heading, i.e checklists, source and quote blocks, etc, but no hierarchy). Is this a sensible use of this function?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.