Commit graph

17 commits

Author SHA1 Message Date
Niklas Fasching
5464ab37d2 Fix race condition surrounding global orgWriter
Since writers are normally only used synchronously (i.e. to write one document
at a time), we don't guard modifications to their internal
state (e.g. temporarily replacing the string.Builder in WriteNodesAsString)
against race conditions.

The package global `orgWriter` and corresponding use cases of it (`org.String`,
`$node.String`) break that pattern - the writer is potentially used from
multiple go routines at the same time. This results in race conditions that
manifest as error messages like e.g.

    could not write output: runtime error: invalid memory address or nil pointer dereference. Using unrendered content.

Additionally, since we catch panics in `Document.Write`, the corresponding
stack trace is lost and dependents of go-org never know what hit them.

As using a writer across simultaneously across go routines is not a standard
pattern, we'll sync the use of the global `orgWriter` instead of trying to make
the actual writer threadsafe; less code noise for the common use case.
2023-03-12 11:28:55 +01:00
Kisaragi Hiu
ab8d3bc16a
highlight: support highlighting lines in the default writer
The hl_lines key is specifically the same as Hugo's key.
2022-07-18 03:56:15 +09:00
Kisaragi Hiu
9b56fc914c
highlight: Expose node params so we can pass options to Chroma 2022-07-18 03:51:04 +09:00
Anthony Fok
f7b18ba94e
Refresh test fixtures for chroma v2.2.0
Missing semicolons have been added since chroma v2.0.1
2022-06-28 06:37:06 -06:00
Niklas Fasching
67951ec664 Update chroma: v0.10.0 -> v2 2022-05-30 17:31:54 +02:00
Elliott Sales de Andrade
2e821b8b7c Update chroma to 0.10.0
- 0.9.2 added `tabindex="0"` to `pre`:
  https://github.com/alecthomas/chroma/pull/515
- 0.10.0 changed around divs and spans, pre and code
  https://github.com/alecthomas/chroma/pull/571
  https://github.com/alecthomas/chroma/pull/572
2022-02-28 00:37:53 -05:00
Elliott Sales de Andrade
65699c036b Rewrite blorg tests without external md5sum
It's a little bit longer, but avoids the need for external tools like
find and md5sum.
2022-02-27 19:15:48 -05:00
Elliott Sales de Andrade
1122a3dfbc Make blorg tests more verbose
By not combining all files into one md5sum.
2022-02-27 15:44:52 -05:00
Elliott Sales de Andrade
2a85f587d3 Fix a typo in blorg test 2022-02-27 15:44:18 -05:00
Niklas Fasching
0e68f1db40 Update stylesheet to handle unwrapped list items 2021-07-20 22:24:29 +02:00
Niklas Fasching
703066682e Update to go v1.16 and embed more extensive default blorg.org
Instead of the bare bones default config we embedded as a string until now we
can use go 1.16 embed to embed the test blorg.org which makes a much better
starting config (if only to see what's possible).
2021-03-01 14:10:34 +01:00
Niklas Fasching
16ccafe8a3 blorg: ignore draft pages 2020-07-24 18:45:22 +02:00
Niklas Fasching
c536adf6e9 Update blorg test - make it actually fail when public changes 2020-06-26 22:21:43 +02:00
Niklas Fasching
d7ef673644 Update blorg about 2020-06-26 21:47:38 +02:00
Niklas Fasching
d2bbcc8881 Update blorg and add it to gh-pages. Update README 2020-06-26 21:00:25 +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
30dd2794cf Introduce blorg: MVP static site generator
hugo is nice - but it's huge. I've never built a static site generator before
and thought the world could use one more - it's not like there's already enough
choice out there!

No, but seriously. I love hugo and it has all the bells and whistles and you
should definitely use that and not this. I just like reinventing the wheel to
learn about stuff - and I like the 80/20 rule. This gives like 60% of what I
want already and is tiny fraction of hugo in terms of LOC (hugo without it's
bazillion dependencies is like 80k+ - this is like 500 and very likely won't
ever grow above let's say 5k).

Also org mode is awesome and why not use it as a configuration format as
well. Let's see where this goes. YOLO.
2020-06-26 18:52:43 +02:00