The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Org::To::HTML - Export Org document to HTML

VERSION

This document describes version 0.236 of Org::To::HTML (from Perl distribution Org-To-HTML), released on 2023-11-06.

SYNOPSIS

 use Org::To::HTML qw(org_to_html);

 # non-OO interface
 my $res = org_to_html(
     source_file   => 'todo.org', # or source_str
     #target_file  => 'todo.html', # defaults return the HTML in $res->[2]
     #html_title   => 'My Todo List', # defaults to file name
     #include_tags => [...], # default exports all tags.
     #exclude_tags => [...], # behavior mimics emacs's include/exclude rule
     #css_url      => '/path/to/my/style.css', # default none
     #naked        => 0, # if set to 1, no HTML/HEAD/BODY will be output.
 );
 die "Failed" unless $res->[0] == 200;

 # OO interface
 my $oeh = Org::To::HTML->new();
 my $html = $oeh->export($doc); # $doc is Org::Document object

DESCRIPTION

Export Org format to HTML. To customize, you can subclass this module.

A command-line utility org-to-html is available in the distribution App::OrgUtils.

Note that this module is just a simple exporter, for "serious" work you'll probably want to use the exporting features or org-mode.

ATTRIBUTES

naked => BOOL

If set to true, export_document() will not output HTML/HEAD/BODY wrapping element. Default is false.

html_title => STR

Title to use in TITLE HTML element, to override #+TITLE setting in the Org document. If unset and document does not have #+TITLE setting, will default to the name of the source file, or (source string).

css_url => STR

If set, export_document() will output a LINK element pointing to this CSS.

inline_images => BOOL

METHODS

new(%args)

$exp->export_document($doc) => HTML

Export document to HTML.

org_to_html

FAQ

Why would one want to use this instead of org-mode's built-in exporting features?

This module might come in handy if you want to customize the Org-to-HTML translation with Perl, for example when you want to customize the default HTML title when there's no #+TITLE setting, change translation of table element to an ASCII table, etc.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Org-To-HTML.

SOURCE

Source repository is at https://github.com/perlancar/perl-Org-To-HTML.

SEE ALSO

For more information about Org document format, visit http://orgmode.org/

Org::Parser

org-to-html

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTORS

  • Harald Jörg <Harald.Joerg@arcor.de>

  • Steven Haryanto <stevenharyanto@gmail.com>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023, 2022, 2020, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Org-To-HTML

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.