emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Some hacks on top of org-publish
@ 2024-12-19 17:45 Nikolaos Chatzikonstantinou
  2024-12-25 13:48 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolaos Chatzikonstantinou @ 2024-12-19 17:45 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I spent the past couple of days hacking together this new blog based
on org-publish that I'd like to show you (comments welcome!):

Blog: <https://createyourpersonalaccount.github.io/blog-v2/>
git repo: <https://github.com/createyourpersonalaccount/blog-v2>

The highlights are that I got

1) MathJax to work
2) TikZ commutative diagrams to work as SVG files
3) Source code blocks + colors (server-side; not a .js coloring client-side)
4) A nice navigation sidebar
5) I get to preview locally if I want but also I have a GitHub
workflow that automatically builds my blog; both views are the same.

In this format all I have to do is add .org files under the
content/pages/ directory (and .tex files under the content/img/
directory for the commutative diagrams) and run `make` and the static
blog is built.

I know there's several ways to improve but I want to bring a couple of
points where you might be able to help me:

1) I got colors in source blocks by post-processing with node.js +
highlight.js the raw HTML. Is it possible to write my own backend that
feeds the source block into my node app?
2) I got several issues with how the org files are exported as HTML,
for example I may want to insert an <article> tag, I may want a div
around content and a div around nav bar, etc. Not everything can be
solved with #+HTML: tags because I don't have precise control of where
those go. Can the HTML backend be edited or do I have to write my own
backend?
3) I am very inexperienced with org backends. What good resources are
out there for this subject?

Finally a highlight of the hacks I had to pull off: apparently
#+INCLUDE: will strip away inline backend information such as
@@html:<b>@@. I figured out that if I write something like
@@html@@a:@@:<b>@@, only the inner @@a:@@ is recognized and stripped,
which leaves me with what I originally wanted! (see
<https://github.com/createyourpersonalaccount/blog-v2/blob/main/content/publish.el#L14-L20>)

Regards,
Nikolaos Chatzikonstantinou


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Some hacks on top of org-publish
  2024-12-19 17:45 Some hacks on top of org-publish Nikolaos Chatzikonstantinou
@ 2024-12-25 13:48 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-12-25 13:48 UTC (permalink / raw)
  To: Nikolaos Chatzikonstantinou; +Cc: emacs-orgmode

Nikolaos Chatzikonstantinou <nchatz314@gmail.com> writes:

> 3) Source code blocks + colors (server-side; not a .js coloring client-side)

Note that ox-html can fontify src blocks by itself. Via htmlize + CSS styles.

> 1) I got colors in source blocks by post-processing with node.js +
> highlight.js the raw HTML. Is it possible to write my own backend that
> feeds the source block into my node app?

Yes, of course. See my next answers. The whole export proces is hackable
on multiple levels.

> 2) I got several issues with how the org files are exported as HTML,
> for example I may want to insert an <article> tag, I may want a div
> around content and a div around nav bar, etc. Not everything can be
> solved with #+HTML: tags because I don't have precise control of where
> those go. Can the HTML backend be edited or do I have to write my own
> backend?

Check out https://orgmode.org/manual/Advanced-Export-Configuration.html

> 3) I am very inexperienced with org backends. What good resources are
> out there for this subject?

See https://orgmode.org/manual/Adding-Export-Backends.html
Org export backends can use inheritance. So, if you need to re-define a
part of backend (if filters are not enough), you can always create a
"subclass" by creating a "derived" backend.

> Finally a highlight of the hacks I had to pull off: apparently
> #+INCLUDE: will strip away inline backend information such as
> @@html:<b>@@. I figured out that if I write something like
> @@html@@a:@@:<b>@@, only the inner @@a:@@ is recognized and stripped,
> which leaves me with what I originally wanted! (see
> <https://github.com/createyourpersonalaccount/blog-v2/blob/main/content/publish.el#L14-L20>)

May you show more concrete example?
#+INCLUDE by itself does not remove export snippets.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-25 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 17:45 Some hacks on top of org-publish Nikolaos Chatzikonstantinou
2024-12-25 13:48 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).