Coder Social home page Coder Social logo

goorgeous's Introduction

This project is deprecated in favor of niklasfasching/go-org. The primary use case was Hugo and go-org was merged as a replacement for Goorgeous.

goorgeous's People

Contributors

ageekymonk avatar carlcolglazier avatar chaseadamsio avatar clockoon avatar edwardbetts avatar sanandak avatar wd avatar zzamboni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

goorgeous's Issues

Empty lines are removed from source blocks

Here's a MWE

#+TITLE: My Hugo Blog Post in Org
#+DATE: 2017-02-13
#+DRAFT: true

** Start a new paragraph
An empty line starts a new paragraph.
#+BEGIN_SRC text
/Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
ligula nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque
eu, sem. Nulla consequat massa quis enim./

/In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam
dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus
elementum semper nisi./
#+END_SRC
/Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, sem. Nulla consequat massa quis enim./

/In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi./

Below, the empty line in the source block is lost.

image

Add support for "smart" quotes

I would love it if setting the following in the front matter of an org file for a Hugo post would cause the output to use "smart" quotes.

#+OPTIONS: ':t

multiline paragraphs within footnotes

Hello,

I'm encountering problem when using multi-line paragraph within a footnote...

Here is the test Hugo post:

+++
category = ["test"] 
date = "2017-09-24T11:20:13+02:00" 
slug = "test" 
tags = ["testing", "org-mode", "hugo"] 
title = "Testing"
+++

The Org homepage[fn:1] now looks a lot better than it used to. Lorem
Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only
five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with
the release of Letraset sheets containing Lorem Ipsum passages, and
more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.

[fn:1] The link is: http://orgmode.org and some additional text to
serve our test-case.

and the rendered output looks as:

...
 <article class="center cf pv5 ph3 ph4-ns mw7">
      <header>
        <p class="f6 b helvetica tracked">
          POSTS
        </p>
        <h1 class="f1">
          Testing
        </h1>
      </header>
      <div class="nested-copy-line-height lh-copy f4 nested-links nested-img mid-gray">
        <p>The Org homepage<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup> now looks a lot better than it used to. Lorem
Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only
five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with
the release of Letraset sheets containing Lorem Ipsum passages, and
more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.</p>

<p>serve our test-case.</p>
<div class="footnotes">

<hr />

<ol>
<li id="fn:1">The link is: http://orgmode.org and some additional text to <a class="footnote-return" href="#fnref:1"><sup>[return]</sup></a></li>
</ol>
</div>

      </div>
    </article>
...

iow. the footnote is cut and not rendered properly:

hugo-footnote

Does it belong to the category of #26 issue?

Of course, if I don't wrap the footnote's paragraph, everything is fine.

Support for underline syntax

Can you please add support for the underline syntax.

Here's a MWE with various formatting markups:

#+TITLE: My Hugo Blog Post in Org
#+DATE: 2017-02-13
#+DRAFT: true

* Formatting
** Fonts
| Format           | Org mode markup syntax |
| *Bold*           | =*Bold*=               |
| /Italics/        | =/Italics/=            |
| _Underline_      | =_Underline_=          |
| =Verbatim=       | ==Verbatim==           |
| +Strike-through+ | =+Strike-through+=     |

Recognize =code=--- as code plus dash...

=code=--- should render as something like <code>code</code>---. With the current goorgeous, the = signs aren't parsed, and it is simply rendered verbatim.

Still, it's a minor thing versus a very nice library.

v2 should work with Blackfriday v2

Your v2 tag still uses the old API, i.e.blackfriday.HtmlRenderer vs the new blackfriday.HTMLRenderer etc.

Probably not related, but you seem to use a very old version of Go Dep. They changed to a TOML file format a year ago.

Customize emphasis exportation

Hi, I've defined (strike-through . "<strong style=\"color : red;\">%s</strong>") in emacs so that strike-through gets exported as red bold text. I wonder if there is a way to do that in goorgeous.

Ordered lists

The org spec allows fine-tuning ordered lists:

  • Allow list number to be anything the user wants using syntax like [@10]. This would be a nice-to-have support.

But more than that, it will be useful to support unordered lists nested in ordered lists and vice-versa.

** Ordered Lists
Ordered list items start with a numeral followed by either a period or a right parenthesis, such as =1.= or =1)=. If you want a list to start with a different value (e.g., 20), start the text of the item with =[@20]=.
#+BEGIN_SRC text
​* Lord of the Rings
My favorite scenes are (in this order)
1. The attack of the Rohirrim
2. Eowyn's fight with the witch king
   + this was already my favorite scene in the book
   + I really like Miranda Otto.
3. [@10] I just randomly want this list number to be 10.
But in the end, no individual scenes matter but the film as a whole.
#+END_SRC
*** Lord of the Rings
My favorite scenes are (in this order)
1. The attack of the Rohirrim
2. Eowyn's fight with the witch king
   + this was already my favorite scene in the book
   + I really like Miranda Otto.
3. [@10] I just randomly want this list number to be 10.
But in the end, no individual scenes matter but the film as a whole.

Ignoring the section numbers and CSS theme, this is how the org to html export looks:

image

Here is the HTML code for the list section:

<div class="outline-text-4" id="text-3-2-1">
    <p>
        My favorite scenes are (in this order)
    </p>
    <ol class="org-ol">
        <li>The attack of the Rohirrim</li>
        <li>Eowyn&rsquo;s fight with the witch king
            <ul class="org-ul">
                <li>this was already my favorite scene in the book</li>
                <li>I really like Miranda Otto.</li>
            </ul>
        </li>
        <li value="10">I just randomly want this list number to be 10.</li>
    </ol>
    <p>
        But in the end, no individual scenes matter but the film as a whole.
    </p>
</div>

panic: runtime error: index out of range

There are probably many good reasons for this error. But I wanted to introduce my use of hugo and ormode so I can understand how to port to goorgeous. I have been using hugo for 2 years with only org-mode source files. How? I just create the .html directly (yes, by hand) in emacs from the .org source file using the orgmode html exporter. It works very well, but, it is a pain in that orgmode has a different concept of "/" than hugo for the underlying filesystem. That forced me to often use absolute rather than relative links for images, etc. My guess is that most of my issues with this error is my use of embedded HTML exports in some org files, I can' imagine goorgeous will parse them. So, I am not really asking for specific help.

What I am wondering, I assume Hugo will now see an .org file and create .html. If the .html already exists (from me exporting it directly from emacs using the orgmode exporter), will hugo overwrite that file? I'm sure I can experiment with that.

I am excited to try goorgeous, and I hope it solves problems I have using ormode with Hugo, but it does make it impossible for me to use V0.19! My punishment for not doing things the "hugo" way.

Support for VERSE block

Hello,

Now that Goorgeous is available via Hugo, a non-profit I have been helping is considering switching to Hugo.

They curate a pretty large site offering several thousands books, all using org-syntax.

Many are poetry books, and use the VERSE block.

#+BEGIN_VERSE
Earth’s cry ascends,
But before it touches Heaven’s Eye,
 It returns.
#+END_VERSE

It would be excellent for us if Goorgeous could support VERSE block.

Thank you for Goorgeous.

Support for :noexport:

If a heading is tagged with :noexport, then that whole subtree is not exported. This is the default org-mode behavior.

Can you please add that feature? It is very useful when you have something "in-works" in the org file, but you are not yet ready to publish it to HTML.

Here's a MWE:

#+TITLE: My Hugo Blog Post in Org
#+DATE: 2017-02-13
#+DRAFT: true

* Title 1
This exports.
* Title 2                                                          :noexport:
This should not export.

Currently it exports like this.

image


An addendum to this request would be to not include the tags in the headings.

Extra space and different theme in code block exports

I wanted to use Org mode to write my blog posts with Hugo, and I have some issues with how source code blocks are exported. If I use:

#+BEGIN_SRC python
  def main():
      pass
#+END_SRC

I get the following output:

<pre><code class="language-python">
  def main():
      pass
</code></pre>

which is different from the output I get by using the same synthax I would use if I were writing in Markdown (in particular, graphically it is shifted to the right and with one line before the code, see image below with the three examples), which gives me:

<div class="highlight" style="background: #272822"><pre style="line-height: 125%"><span></span><span style="color: #66d9ef">def</span> <span style="color: #a6e22e">main</span><span style="color: #f8f8f2">():</span>
    <span style="color: #66d9ef">pass</span>
</pre></div>

Furthermore, with that approoach I could do something like:

{{< highlight python "linenos=inline,hl_lines=2 3" >}}
def main():
    i = 2
    j = 3
    pass
{{< / highlight >}}

which would yield the following:

<p><div class="highlight" style="background: #272822"><pre style="line-height: 125%"><span></span><span style="background-color: #f0f0f0; padding: 0 5px 0 5px">1 </span><span style="color: #66d9ef">def</span> <span style="color: #a6e22e">main</span><span style="color: #f8f8f2">():</span>
<span style="background-color: #f0f0f0; padding: 0 5px 0 5px">2 </span><span style="background-color: #49483e">    <span style="color: #f8f8f2">i</span> <span style="color: #f92672">=</span> <span style="color: #ae81ff">2</span>
</span><span style="background-color: #f0f0f0; padding: 0 5px 0 5px">3 </span><span style="background-color: #49483e">    <span style="color: #f8f8f2">j</span> <span style="color: #f92672">=</span> <span style="color: #ae81ff">3</span>
</span><span style="background-color: #f0f0f0; padding: 0 5px 0 5px">4 </span>    <span style="color: #66d9ef">pass</span>
</pre></div>
</p>

This is how the three examples appear graphically (note how the first code block is shifted below and to the right, compared to the second, one other thing I notice is the different theme... the second and third examples use the settings specified for Pygments, I believe):

Support org spec for #+HTML

In markdown, we use <!--more--> as a marker of "end of summary" for hugo.

Reference

Can the below be supported for org?

** more ..
Here is how you can insert a =<!--more-->= to mark the end of summary for hugo parsing.
#+BEGIN_SRC text
This is on line 1
#+HTML:<!--more-->
This is on line 2
#+END_SRC

This is on line 1
#+HTML:<!--more-->
This is on line 2

Support #+HTML

This feature request is more than just support <!--more--> 😄

It is about supporting the org #+HTML: syntax.

Ref - Quoting HTML tags in org

Note that it can be #+HTML: or #+html:; it's case-insensitive.

Support @@html:...@@

Below MWE shows how the @@html:...@@ syntax (also mentioned in the above reference) can be used to force line breaks without starting a new <p> block.

Use this at the end of lines: =@@html:<br>@@=
#+BEGIN_SRC text
This is on line 1 @@html:<br>@@
This is on line 2
#+END_SRC

This is on line 1 @@html:<br>@@
This is on line 2

Note that a user can have this in their org file:

#+BEGIN_SRC text
This is on line 1 @@html:<br>@@@@latex:\\@@
This is on line 2
#+END_SRC

or

#+BEGIN_SRC text
This is on line 1 @@latex:\\@@@@html:<br>@@
This is on line 2
#+END_SRC

But the HTML parser only extracts the <br> portion from @@html:<br>@@.

exporting images in org mode

Hello, I'm writing hugo blogs using org-mode. When inserting an image link like [[/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png]], hugo doesn't export the image.

Four consecutive lines beginning with '#' crash hugo

I'm using goorgeous with hugo. Tried to create a post with an example config file.

#+BEGIN_EXAMPLE
# Create custom menu entries by defining a label and a link for
# them. Since you can also link posts, you've the option the
# place the links before or after them.
#
# E.g.: "Home" appears before all linked posts in the menu
# and "Tags" / "Categories" after them.
#+END_EXAMPLE

And got a panic.

Further tests show that regardless of the ****_EXAMPLEstatements, the error occurs if there are four consecutive lines starting with # in the Org file.

#
#
#
#

results in:

goroutine 37 [running]:
github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous.OrgOptions(0xc420309900, 0x11fa, 0x1300, 0x1b3d840, 0xc4207968e0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:75 +0x26db
github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous.Org(0xc420309900, 0x11fa, 0x1300, 0x1b3d840, 0xc4207968e0, 0x1b39b40, 0xc420354300, 0x100)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:50 +0x53
github.com/gohugoio/hugo/helpers.orgRender(0xc4201c3600, 0xc42026f470, 0x0, 0x0, 0xc42019561c, 0x3, 0x1b39b40, 0xc420354300, 0x10115e8, 0x80, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:681 +0x1de
github.com/gohugoio/hugo/helpers.ContentSpec.RenderBytes(0xc42026f470, 0x0, 0x0, 0xc42019561c, 0x3, 0x1b39b40, 0xc420354300, 0xc4201c3600, 0xc4207966c0, 0x1, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:427 +0x15e
github.com/gohugoio/hugo/hugolib.(*Page).renderContent(0xc42079c000, 0xc420307300, 0x11fa, 0x1300, 0xc420307300, 0x11fa, 0x1300)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/page.go:639 +0x28d
github.com/gohugoio/hugo/hugolib.commonConvert(0xc42079c000, 0xc420031658, 0x16307a1, 0x16d8660, 0xc420770730)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/handler_page.go:144 +0x24f
github.com/gohugoio/hugo/hugolib.orgHandler.PageConvert(0x0, 0x0, 0x0, 0xc42079c000, 0x15cd548, 0xc42010ff07, 0x3, 0x17bcfb3)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/handler_page.go:122 +0x2b
github.com/gohugoio/hugo/hugolib.(*orgHandler).PageConvert(0xc4201fc160, 0xc42079c000, 0xc4201fc160, 0xc420031708, 0x15cd428, 0x1b375e0)
	<autogenerated>:785 +0x69
github.com/gohugoio/hugo/hugolib.(*MetaHandle).Convert(0xc420796360, 0x17b8e00, 0xc42079c000, 0xc42007c280, 0xc420722360)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/handler_meta.go:77 +0xa7
github.com/gohugoio/hugo/hugolib.pageConverter(0xc4207223c0, 0xc420722360, 0xc42070ca60)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/site.go:1409 +0xfa
created by github.com/gohugoio/hugo/hugolib.(*Site).convertSource
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/site.go:1337 +0x18c

Three lines

#
#
#

are processed without error.

Links to .org sites are mangled

The following:

[[www.qgis.org][QGIS]]

Renders as

<a href="http://www.qgis" title="QGIS">QGIS</a>

This is in Hugo version v 0.25.1 (I don't know how to check the goorgeous version that hugo is using...)

hugo version
Hugo Static Site Generator v0.25.1 darwin/amd64 BuildDate: 2017-07-11T11:48:48-04:00

Thanks,
Sridhar

Table with a single row causes a panic.

The following line is giving the library problems:

| Row |

Output (running inside hugo):

panic: runtime error: index out of range

goroutine 1283 [running]:
github.com/spf13/hugo/vendor/github.com/chaseadamsio/goorgeous.(*parser).generateTable(0xc4205d9600, 0xc4201976c0, 0xc4202de840, 0x10, 0x2b9)
	/Users/bep/go/src/github.com/spf13/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:395 +0x901
github.com/spf13/hugo/vendor/github.com/chaseadamsio/goorgeous.OrgOptions(0xc4205d8d00, 0x8ec, 0x900, 0xec62a0, 0xc4201e1e00, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/spf13/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:101 +0x6ab
github.com/spf13/hugo/vendor/github.com/chaseadamsio/goorgeous.Org(0xc4205d8d00, 0x8ec, 0x900, 0xec62a0, 0xc4201e1e00, 0xec2700, 0xc4201d5080, 0x100)
	/Users/bep/go/src/github.com/spf13/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:50 +0x53
github.com/spf13/hugo/helpers.orgRender(0xc4203d2ea0, 0xc420179ce0, 0x0, 0x0, 0x0, 0x0, 0xec2700, 0xc4201d5080, 0x40f928, 0x90, ...)
	/Users/bep/go/src/github.com/spf13/hugo/helpers/content.go:683 +0x1de
github.com/spf13/hugo/helpers.ContentSpec.RenderBytes(0xc420179ce0, 0x0, 0x0, 0x0, 0x0, 0xec2700, 0xc4201d5080, 0xc4203d2ea0, 0xc4201e17e0, 0x1, ...)
	/Users/bep/go/src/github.com/spf13/hugo/helpers/content.go:429 +0x15e
github.com/spf13/hugo/hugolib.(*Page).renderContent(0xc4204a2a00, 0xc4205d8400, 0x8ec, 0x900, 0xc4205d8400, 0x8ec, 0x900)
	/Users/bep/go/src/github.com/spf13/hugo/hugolib/page.go:605 +0x28d
github.com/spf13/hugo/hugolib.commonConvert(0xc4204a2a00, 0xc42052e658, 0x9f8e61, 0xa97960, 0xc420192e10)
	/Users/bep/go/src/github.com/spf13/hugo/hugolib/handler_page.go:140 +0x1ce
github.com/spf13/hugo/hugolib.orgHandler.PageConvert(0x0, 0x0, 0x0, 0xc4204a2a00, 0x99d668, 0xc42059459d, 0x3, 0xb70cc1)
	/Users/bep/go/src/github.com/spf13/hugo/hugolib/handler_page.go:120 +0x2b
github.com/spf13/hugo/hugolib.(*orgHandler).PageConvert(0xc4201e0200, 0xc4204a2a00, 0xc4201e0200, 0xc42052e708, 0x99d548, 0xec0260)
	<autogenerated>:542 +0x69
github.com/spf13/hugo/hugolib.(*MetaHandle).Convert(0xc4201e1760, 0xb6db40, 0xc4204a2a00, 0xc4201b6240, 0xc4205972c0)
	/Users/bep/go/src/github.com/spf13/hugo/hugolib/handler_meta.go:77 +0xa7
github.com/spf13/hugo/hugolib.pageConverter(0xc420597320, 0xc4205972c0, 0xc420192130)
	/Users/bep/go/src/github.com/spf13/hugo/hugolib/site.go:1354 +0xfa
created by github.com/spf13/hugo/hugolib.(*Site).reProcess
	/Users/bep/go/src/github.com/spf13/hugo/hugolib/site.go:728 +0x14e0

Everything works fine if there is more than one row, but a single row is causing a panic.

I was able to reproduce the issue by adding the following to TestRenderingTables:

"table-single-cell": {
	"| r |\n",
	"\n<table>\n<tbody>\n<tr>\n<td>r</td>\n</tr>\n</tbody>\n</table>\n",
},

This produced the following output for go test:

--- FAIL: TestRenderingTables (0.00s)
panic: runtime error: index out of range [recovered]
	panic: runtime error: index out of range

goroutine 18 [running]:
testing.tRunner.func1(0xc420073c70)
	/usr/lib/go/src/testing/testing.go:622 +0x29d
panic(0x536a60, 0x602a10)
	/usr/lib/go/src/runtime/panic.go:489 +0x2cf
github.com/chaseadamsio/goorgeous.(*parser).generateTable(0xc420186d00, 0xc420180bd0, 0xc420180c60, 0x6, 0x40)
	/home/carl/programs/go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:406 +0x901
github.com/chaseadamsio/goorgeous.OrgOptions(0xc42000feb0, 0x6, 0x8, 0x5f7500, 0xc42016cf00, 0x5f7500, 0xc42016cf00, 0xc42000feb0)
	/home/carl/programs/go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:110 +0x6c3
github.com/chaseadamsio/goorgeous.OrgCommon(0xc42000feb0, 0x6, 0x8, 0xc42000feb0, 0x6, 0x8)
	/home/carl/programs/go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:45 +0x88
github.com/chaseadamsio/goorgeous.testOrgCommon(0xc4201470e0, 0xc420073c70)
	/home/carl/programs/go/src/github.com/chaseadamsio/goorgeous/goorgeous_test.go:504 +0x120
github.com/chaseadamsio/goorgeous.TestRenderingTables(0xc420073c70)
	/home/carl/programs/go/src/github.com/chaseadamsio/goorgeous/goorgeous_test.go:450 +0x2c7
testing.tRunner(0xc420073c70, 0x569810)
	/usr/lib/go/src/testing/testing.go:657 +0x96
created by testing.(*T).Run
	/usr/lib/go/src/testing/testing.go:697 +0x2ca
exit status 2
FAIL	github.com/chaseadamsio/goorgeous	0.004s

wrong output, when mixing raw html with org-mode

Code 1

#+HTML: <div class="outline-2" id="meta" style="color:green">
| *Author* | {{{author}}} ({{{email}}})    |
| *Date*   | {{{time(%Y-%m-%d %H:%M:%S)}}} |
#+HTML: </div>

Code 2

<div class="outline-6" id="meta" style="color:green">
| *Author* | {{{author}}} ({{{email}}})    |
| *Date*   | {{{time(%Y-%m-%d %H:%M:%S)}}} |
</div>

Currently this tool does not support #+HTML , like the code 1. But, actually Hugo has already supported the rendering for the raw html.
I try to test it with Code 2, mixing raw html with org-mode. As a result, get the wrong output

  1. The actually output:
<div class="outline-6" id="meta" style="color:green"><p></p>

<p></p></div>
<table>
<tbody>
<tr>
<td><strong>Author</strong></td>
<td>{{{author}}} ({{{email}}})</td>
</tr>

<tr>
<td><strong>Date</strong></td>
<td>{{{time(%Y-%m-%d %H:%M:%S)}}}</td>
</tr>
</tbody>
</table>
  1. Expected output:
<div class="outline-6" id="meta" style="color:green"><p></p>

<p></p>
<table>
<tbody>
<tr>
<td><strong>Author</strong></td>
<td>{{{author}}} ({{{email}}})</td>
</tr>

<tr>
<td><strong>Date</strong></td>
<td>{{{time(%Y-%m-%d %H:%M:%S)}}}</td>
</tr>
</tbody>
</table>

</div>

multiline paragraphs with emphasis within quotes

Do I miss something, but I do experience similar/same problem with e.g.:

In #64 the problem was solved for footnotes, but it still does exist for quotes:

#+BEGIN_QUOTE
Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only
five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. *It was popularised in the 1960s with
the release of Letraset sheets containing Lorem Ipsum passages, and
more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.*
#+END_QUOTE

renders as:
quote-shot

Support for #+ATTR_HTML

In org-mode, the #+ATTR_HTML syntax is used to specify attributes for the next block.

Example:

#+ATTR_HTML: :class goorgeous
I like Rust better.

gives

<p class="goorgeous">
I like Rust better.
</p>

You can have multiple lines, and multiples attributes per line, like so:

#+ATTR_HTML: :alt Go is fine though.
#+ATTR_HTML: :width 300 :style border:2px solid black;
[[file:https://golang.org/doc/gopher/pkg.png]]

This is probably easier to implement than #19 (although both would be useful).
Also, thank you! Support for org-mode made me switch to Hugo ;)

Support rules in org tables

Org tables are supported but the horizontal rules in them are not.

#+TITLE: My Hugo Blog Post in Org
#+DATE: 2017-02-13
#+DRAFT: true

* Org table
|---+---+---|
| a | b | c |
|---+---+---|
| d | e | f |
|---+---+---|

Newline should not create a new HTML paragraph

The paragraph marking style in org is the same as in markdown.

If I have

abcd
efgh

ijkl
mnop

it should export to HTML as

<p>
abcd
efgh
</p>

<p>
ijkl
mnop
</p>

But instead, it is currently creating a paragraph for each new line.


This is the expected behavior:

  • A single newline does not end a paragraph.
  • Two or more consecutive newlines end a paragraph (basically one ore more blank lines).

I found this issue because I like to enable auto-fill-mode for my posts with fill-column set to 70 in emacs.

Linebreaks in lists are preserved

I tried to convert the markdown content of our Hugo site to org. Which worked fine. Unfortunately Hugo does preserve the line-breaks in lists.

In the attached image I've marked the occurrences with arrows. The red markers are for the next ticket 😄 .

documentation_-_mobileorg

The expected outcome would be as shown in the next image which is the Hugo markdown rendering.

documentation_-_mobileorg

And the source code:

_users_peppe_documents_github_mobileorg_github_io_content_documentation_index_org

crash with an empty headline

---
title: "My First Post"
date: 2018-04-03T22:00:19+08:00
draft: false
---

* Head A
*

leave the second headline empty(only has *)

hugo will crash with:


Building sites … panic: runtime error: index out of range

goroutine 55 [running]:
github.com/chaseadamsio/goorgeous.isHeadline(0xc4205e3007, 0x1, 0xff9, 0x0)
        /root/go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:345 +0x74
github.com/chaseadamsio/goorgeous.OrgOptions(0xc42034f1f0, 0x9, 0x10, 0x1049fa0, 0xc42085dbc0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:230 +0x14e4
github.com/chaseadamsio/goorgeous.Org(0xc42034f1f0, 0x9, 0x10, 0x1049fa0, 0xc42085dbc0, 0x20, 0xc42061b828, 0x0)
        /root/go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:50 +0x53
github.com/gohugoio/hugo/helpers.orgRender(0xc4204d8b60, 0xc4204a72c0, 0x0, 0x0, 0x0, 0x0, 0x46, 0x0, 0xc4204a1dd0, 0xc4204a1da0, ...)
        /root/go/src/github.com/gohugoio/hugo/helpers/content.go:705 +0x1f5
github.com/gohugoio/hugo/helpers.ContentSpec.RenderBytes(0xc4204a72c0, 0x0, 0x0, 0x0, 0x0, 0x46, 0x0, 0xc4204a1dd0, 0xc4204a1da0, 0x102bde0, ...)
        /root/go/src/github.com/gohugoio/hugo/helpers/content.go:464 +0x20a
github.com/gohugoio/hugo/hugolib.(*Page).renderContent(0xc420535900, 0xc42034f150, 0x9, 0x10, 0xc42034f150, 0x9, 0x10)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page.go:742 +0x243
github.com/gohugoio/hugo/hugolib.(*contentHandlers).handlePageContent.func1(0xc420863680, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page_bundler_handlers.go:286 +0x29c
github.com/gohugoio/hugo/hugolib.(*contentHandlers).processFirstMatch.func1(0xc420863680, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page_bundler_handlers.go:84 +0xa0
github.com/gohugoio/hugo/hugolib.(*contentHandlers).parsePage.func1(0xc420863680, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page_bundler_handlers.go:262 +0x370
github.com/gohugoio/hugo/hugolib.(*contentHandlers).processFirstMatch.func1(0xc420863680, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page_bundler_handlers.go:84 +0xa0
github.com/gohugoio/hugo/hugolib.(*siteContentProcessor).readAndConvertContentFile(0xc4208689b0, 0xc420863640, 0x0, 0x0)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page_bundler.go:202 +0x70
github.com/gohugoio/hugo/hugolib.(*siteContentProcessor).process.func2(0x8, 0xf03260)
        /root/go/src/github.com/gohugoio/hugo/hugolib/page_bundler.go:129 +0x139
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc420863600, 0xc42085d5c0)
        /root/go/src/golang.org/x/sync/errgroup/errgroup.go:58 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
        /root/go/src/golang.org/x/sync/errgroup/errgroup.go:55 +0x66

Panic: slice bounds out of range

Hi, thanks for the library!

Only one critical problem as titled.

Example input: https://raw.githubusercontent.com/Digit/witch/master/birch/README.org

goorgeous.OrgCommon(input)
/usr/local/go/src/runtime/panic.go:489 (0x102c2bf)
	gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/usr/local/go/src/runtime/panic.go:35 (0x102afae)
	panicslice: panic(sliceError)
/Users/unknwon/Applications/Go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:99 (0x1572136)
	OrgOptions: p.generateParagraph(&output, tmpBlock.Bytes()[:len(tmpBlock.Bytes())-1])
/Users/unknwon/Applications/Go/src/github.com/chaseadamsio/goorgeous/goorgeous.go:39 (0x1571ac8)
	OrgCommon: return OrgOptions(input, renderer)

Title-casing of keys

I don't know org-mode, but a question related to Hugo:

Given a frontmatter of #+title: foo, goorgeous returns:

map[string]interface{}{"Title": "foo"}

The other frontmatter parsers in Hugo leave the key casing as-is. Is it necessary for the string to be title-cased?

Paragraphs that are not followed by an empty line are not parsed correctly

When a paragraph is not followed by an empty line, it is incorrectly moved to the following section by goorgeous.

This org snippet illustrates the problem:

* Foo
Foo paragraph.
* Bar
Bar paragraph.

Expected result: The snippet above should result in the following output:

<h1 id="foo">Foo</h1>

<p>Foo paragraph.</p>

<h1 id="bar">Bar</h1>

<p>Bar paragraph.</p>

Actual result: The snippet above results in the following output:

<h1 id="foo">Foo</h1>

<h1 id="bar">Bar</h1>

<p>Foo paragraph.
Bar paragraph.</p>

While empty-line paragraph style seems to be preferred in the org-mode community, org.el renders the example above correctly. Also, the org syntax reference states that "[e]mpty lines and other elements end paragraphs".

Here's a branch that adds a (failing) test case for this issue:
https://github.com/sometimesfood/goorgeous/tree/linebreak-fail
sometimesfood@8cc4f08

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.