Commit graph

47 commits

Author SHA1 Message Date
Niklas Fasching
6cfae31132 Add support for COMMENT headlines
https://orgmode.org/manual/Comment-Lines.html
2024-08-20 15:26:31 +02:00
prmadev
3d00478629
feat: make hr tags self closing 2023-10-08 16:50:05 +03:30
linchen2chris
29e77a0555 update the fixtures 2023-03-02 17:56:27 +08:00
xjzi
81cb0c3735 Don't wrap simple titles in <p>
Before this commit, if an org document was titled "Title here", the
first line of HTML output would be as follows:

<h1 class="title"><p>Title here\n</p></h1>

This commit changes the HTML writer to instead output the following:

<h1 class="title">Title Here</h1>

I conversatively modified the code, so there might be more cases where
elements should be omitted from the title.
2022-08-21 12:37:51 -04:00
Ori
4d3a099922 For simple list items, don't wrap in <p> tags
This also removes extra newlines for simple list items, see changes to
tests for details.

Closes #57
2021-07-13 23:41:32 +02:00
Niklas Fasching
b9f05878fa Revert "Manually install go 1.16 until github actions updates image"
This reverts commit bf7f957af2.

We still have to manually install it for now but we don't have to fuck around
with env vars anymore. github actions still defaults to go 1.15 [1]. Whatever.

[1]
```
ls -lisah $(which go)
108022 0 lrwxrwxrwx 1 root root 42 Mar 18 22:15 /usr/bin/go ->
/opt/hostedtoolcache/go/1.15.10/x64/bin/go
```
2021-03-28 17:23:05 +02:00
Niklas Fasching
bf7f957af2 Revert Me: Manually install go 1.16 until github actions updates image 2021-03-01 14:19:14 +01:00
Niklas Fasching
1b68e209ac Migrate from travisci to github actions
because all my other repos use it and hackernews told me travisci free tier is
dead.
2021-01-02 20:42:59 +01:00
Perry Kundert
4cf9dff010 Add a lower-case org-mode drawer 🔚 test 2020-11-20 11:41:24 -08:00
Niklas Fasching
64b2b22270 Fix list item parsing and headline token lvls
As headlines are always lvl (indent) 0 I thought it would be clever to abuse
the lvl field to store the headline lvl. Well, here we are - it wasn't clever.

List items only end when their parent ends or they run into something that's
not indented enough - everything else becomes part of the list item. Abusing
the token.lvl field (indent) for the headline lvl means headlines look indented
to the list item parsing logic - i.e. they become part of the list item if the
headline has a high enough lvl. That should never happen - so let's get rid of
the hack and (re-)calculate the headline lvl when we need it.
2020-07-22 13:49:58 +02:00
Niklas Fasching
add727c011 html: Wrap headline+content & headline content in containers
Org mode does it.
2020-06-29 16:48:46 +02:00
Niklas Fasching
a383eef7a6 html: Remove cosmetic whitespace inside p tags
All tags are put on a line by themselves to help with visual
diffing. Apparently this extra cosmetic whitespace causes problems inside p
tags for ppl who want to use `white-space: pre`. Not much hurt for visual
diffing in removing cosmetic whitespace for just p tags and can't think of
anything that would break because of this right now. So let's do it and wait
for things to break.
2020-06-26 18:55:15 +02:00
Niklas Fasching
cbf1b8c38c html: Allow inline html export in #+TITLE 2020-04-16 15:18:33 +02:00
Niklas Fasching
c68d931100 html: Fix example blocks - escape html
While example blocks do not render inline markup and are thus parsed raw in
some way, their contents are not literal html and thus still need to be html
escaped.
2020-03-31 16:30:28 +02:00
Niklas Fasching
f1361615ed html: Allow limiting level of headlines to be included in toc
The org mode toc OPTION does not just support true/false - it also allows
specifying the max headline level [1] to be included in the toc.

[1] headline level as seen in org mode - not the html tag level
2020-01-20 18:44:09 +01:00
Niklas Fasching
614307a8f5 HTML export: Export #+TITLE as h1 and offset other headlines accordingly
emacs exports #+TITLE as <h1> and all other headlines accordingly as
`lvl + 1` - we'll go with that.
2019-12-22 14:17:14 +01:00
Niklas Fasching
4292628c80 Fix ExplicitLineBreak parsing
fuzzed index out of range and moved range check into for condition as \\
followed by spaces at the end of the inline text should not be turned into an
ExplicitLineBreak (just like \\ not followed by spaces).
2019-10-29 01:03:10 +01:00
Niklas Fasching
f69b043136 Fix index out of range in headline priority parsing
fuzzed - counting is hard...
2019-10-27 15:24:24 +01:00
Niklas Fasching
adeeb9235d Handle malformed :PROPERTY: drawers
Until now we'd get index out of range errors trying to index into the match if
:PROPERTIES: was followed by a non-property. Thanks fuzz
2019-09-28 15:12:19 +02:00
Niklas Fasching
97fe8b7850 html: Fix code block export (superfluous newlines)
I didn't consider that all newlines in the pre block will be printed and we
thus shouldn't wrap html that has it's tags on separate lines (i.e. contains
superfluous newlines) - wrapping in a div less accurately represents
org-html-export but it provides the same information and gives us more freedom
in the return value of HighlightCodeBlock as well as allowing us to keep the
html tags on new lines (consistency).
2019-07-28 16:40:09 +02:00
Niklas Fasching
777899c803 HTML export: Update footnote numbering to start with 1
I went with 0 based numbering because it was easier but after looking at the
results 0 based numbering looks bad to me... let's start with 1 like everyone
else as it's just a few more lines of code.
2019-07-07 21:25:42 +02:00
Niklas Fasching
37d33c1206 HTML export: Export src block language as css class
Org mode exports source blocks with the language as a css-class of the exported
source block - it's easy enough to do the same.
2019-07-07 10:19:24 +02:00
Niklas Fasching
6dc04b4b02 Refactor footnote handling
- Remove unused footnote section title option
- Move away from maintaining a list of footnotes in the document (only needed
  for html export, potential maintainance overhead when modifying the document)
  and rather only build it on export when required.
- HTML export: Rename all footnotes to numbers (so we can support anonymous
  footnote references by assigning them a number) and export footnotes in order
  of reference, not definition. The implementation of this makes it natural to
  also stop exporting unused footnote definitions so we do that as well.
2019-07-07 10:01:43 +02:00
Niklas Fasching
50395f999a Update misc.org
a recent org mode update broke goorgeous src blocks - already handled, just
added a test case (https://github.com/chaseadamsio/goorgeous/issues/92)
2019-06-04 12:30:13 +02:00
Niklas Fasching
00d5a9cdd2 Update misc.org
update list of fixed goorgeous issues
2019-01-08 23:49:28 +01:00
Niklas Fasching
d3d3b6c593 Fix table of contents for hugo
Hugo has some hardcoded checks that have to be fulfilled in its Table of
Contents extraction workflow (helpers/content ExtractTOC). It's easier this
way...
2018-12-26 18:53:31 +01:00
Niklas Fasching
940b1c7125 Fix outline nesting
oops - that got lost during the rebase - here we go
2018-12-26 17:44:01 +01:00
Niklas Fasching
d921a68a55 Add support for Table of Contents 2018-12-26 16:10:23 +01:00
Niklas Fasching
eb7db9b968 Improve footnote handling
- Footnotes separator rather than headline to get around i18n
- Warn on footnote redefinition
- Do not export footnote definitions at point of definition, only in the
  footnote section.
- Do not automatically exclude Footnotes section to get around possibly hiding
  other content of such a section - and i18n.
  The user has the choice of explicitly hiding the section via a :noexport:
  tag.

and some other refactoring
2018-12-26 15:42:12 +01:00
Niklas Fasching
beff0c0d8a Add support for EXCLUDE_TAGS and :noexport: 2018-12-26 15:31:48 +01:00
Niklas Fasching
c3d635eacb Add more test cases 2018-12-21 16:05:38 +01:00
Niklas Fasching
bc9c496f97 Misc cleanup: SETUP_FILE -> SETUPFILE, empty example lines, ... 2018-12-20 15:43:16 +01:00
Niklas Fasching
c23f8cc281 Add support for SETUP_FILE 2018-12-19 19:58:25 +01:00
Niklas Fasching
aa42998dbc Add support for headline CUSTOM_ID property & linking
this introduces the PropertyDrawer node to make it easier to access the
properties associated to a headline - normal drawers don't parse their content
into kv pairs
2018-12-19 14:31:07 +01:00
Niklas Fasching
a60f844e38 Add basic support for statistic tokens (e.g. [100%] [1/1])
Org mode does not care where those tokens are when it comes to the
export (afaict). We'll do the same.

(They should only be in the first line of a list item or a headline)
2018-12-18 14:14:08 +01:00
Niklas Fasching
dce67eaddf Improve ATTR_HTML keyword parsing
Org mode separates kvs not as initially assumed by whitespace (~ csv) but
rather at keywords (~ :\w+).

This is still not replicating Org mode behaviour though as I decided against
attributes ignoring multi-definitions. Instead we stack their
values (and those existing on the element) for certain attributes (class, style
for now).

e.g.
[[foo]]

would become <foo class="a"> in Org mode but becomes <foo class="a b"> with
go-org.
2018-12-18 00:16:41 +01:00
Niklas Fasching
a861437185 Fix naming: org-mode -> Org mode
https://scripter.co/how-do-i-write-org-mode/

Prefer “Org mode” to “Org-mode” or “org-mode”. This is simply because it reflects an existing convention in The Emacs Manual which consistently documents mode names in this form - “Text mode”, “Outline mode”, “Mail mode”, etc.
2018-12-17 22:34:15 +01:00
Niklas Fasching
0eb3baf1bb Improve handling of elements containing raw text
While adding another test case from the goorgeous issues it became clear that
inline markup and html entity replacement were erronously applied to raw text
elements like inline code =foo=, src/example/export blocks, example lines,
etc.

To correctly handle those cases in both org and html exports a new
parseRawInline method had to be added.

Also some misc html export whitespace fixes and stuff
2018-12-17 13:40:15 +01:00
Niklas Fasching
0186545123 Add basic support for drawers 2018-12-17 00:01:03 +01:00
Niklas Fasching
24ace5aa0e html: Export headline todo status & tags 2018-12-16 22:45:18 +01:00
Niklas Fasching
6887fb2e02 Add wasm demo to github pages 2018-12-16 19:54:17 +01:00
Niklas Fasching
2947d7632d Support basic #+INCLUDE (src/example/export block only)
including org files is more complex - e.g. footnotes need to be namespaced to
their source file. org does this by prefixing each included files footnotes
with a number - but even that is not enough as it doesn't guarantee
uniqueness.

As I don't have a usecase for it, I'll avoid the additional complexity for
now.
2018-12-14 17:09:00 +01:00
Niklas Fasching
f28f400d7e Add table pretty printing & alignment
Also dismissed implementing colgroups for now - had it but didn't like the
added complexity for a very questionable benefit - i've actually never used
that feature of org tables...
2018-12-14 15:49:40 +01:00
Niklas Fasching
a55ed30e3d Add support for org-entities (e.g. ndash, mdash, \Aacute) 2018-12-11 22:12:51 +01:00
Niklas Fasching
ffe06b50f2 Add support for #+HTML 2018-12-11 22:12:51 +01:00
Niklas Fasching
0a905ca172 Fix HTML_ATTR rendering (naive)
- was missing spaces between attributes when rendering to org
- was duplicating attributes when rendering to html - now we join / replace
  attributes depending on the name - for now only class & style are appended
2018-12-11 20:38:24 +01:00
Niklas Fasching
fb6bc2d7de Split example.org into separate files
... hopefully correctly

This will hopefully improve ease of developing (more granular test results) and
prepares us for adding example org->html renders for gh-pages
2018-12-11 14:43:44 +01:00