Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AsciiDoc #470

Closed
tbrooke opened this issue Sep 3, 2014 · 37 comments
Closed

Support for AsciiDoc #470

tbrooke opened this issue Sep 3, 2014 · 37 comments

Comments

@tbrooke
Copy link

tbrooke commented Sep 3, 2014

No description provided.

@ejemba
Copy link

ejemba commented Sep 11, 2014

I confirm I badly need the asciidoc support for hugo !

@spf13 spf13 added this to the v0.13 milestone Sep 11, 2014
@voxadam
Copy link

voxadam commented Oct 12, 2014

I posted this in the Feature Request section of the forum a few days ago as I wasn't aware of this ticket. I figured I'd go ahead and crosspost it here for completeness.

I'd also love to see support for AsciiDoc in Hugo. Markdown is fine for simple posts to Stack Overflow, issue reports on GitHub, Bugzilla reports (a recently added, long overdue, feature), and other lightweight use cases but it doesn't have anywhere near the expressiveness of AsciiDoc. As Dan Allen so eloquently, if not a slightly inflammatorally (I don't care if that's not a word, it should be and English is a living language), put it in his Google+ post:

"If Markdown is a 1st-grader, then AsciiDoc is PhD student."

AsciiDoc is not only far richer but there are already high quality tools for producing a wide range of output formats: HTML5, XHTML, DocBook, PDF, EPUB, DVI, LaTeX, roff, and Postscript, to name a few. You may ask how many of those formats would useful in in the case of a blogging platform but I doubt that I'm alone in really liking the idea of having my posts available for download in PDF and EPUB formats. This would make it possible to easily email a PDF of a post to a colleague or to have the option of loading a long post onto your ebook so you can read it on your daily commute on the train or maybe on a long flight. It would also allow well formatted for posts to later be reused in a project's documentation (the less time I have to spend writing docs the better, reuse is a wonderful thing).

I'm not saying that Markdown should be replaced, or for that matter, even depreciated. I can imagine banging out a quick post using Markdown and other times for more complex posts using AsciiDoc. I simply can't fathom any downside to offering users more options.

I can understand not wanting to take on the extra work required to write an AsciiDoc interpreter or porting AsciiDoctor from Ruby to Go but as luck were to have it you don't have to. It would seem that, the obviously talented, VonC has done much of the work already with his AsciiDocGo project (he even included unit test coverage for the entire codebase). And to make things even simpler he has made his code available under the MIT license which makes it 100% compatible with Hugo's new Apache 2 license and likely with the <0.13's SimPL 2.0 license.

@txchen
Copy link

txchen commented Oct 14, 2014

asciidoc +1

@ollin
Copy link

ollin commented Jan 11, 2015

asciidoc +1

2 similar comments
@0xMF
Copy link

0xMF commented Jan 12, 2015

asciidoc +1

@bep
Copy link
Member

bep commented Jan 12, 2015

asciidoc +1

@voxadam
Copy link

voxadam commented Jan 13, 2015

Don't worry folks, Steve (aka @spf13) has stated publicly[1] that he's diligently working on a solution to bring asciidoc support to Hugo.

[1] http://discuss.gohugo.io/t/contributing-golang-code/223/3

@spf13
Copy link
Contributor

spf13 commented Jan 13, 2015

I've made good progress on this. Love seeing the enthusiasm here.

@0xMF
Copy link

0xMF commented Jan 15, 2015

@spf13 thanks! Liking Hugo thus far, making and using a theme seems easy and intuitive (so far) ;)

@bguiz
Copy link

bguiz commented Jan 23, 2015

+1 for asciidoc
(yet another one)
Is this likely to come in in v0.13 or can we be waiting for this in v0.14?

@spf13
Copy link
Contributor

spf13 commented Jan 23, 2015

I really hope in v0.13 even if it's just experimental.

Steve Francia
http://stevefrancia.com
http://spf13.com
http://twitter.com/spf13

On Thu, Jan 22, 2015 at 7:18 PM, Brendan Graetz notifications@github.com
wrote:

+1 for asciidoc
(yet another one)
Is this likely to come in in v0.13 or can we be waiting for this in v0.14?


Reply to this email directly or view it on GitHub
#470 (comment).

anthonyfok added a commit that referenced this issue Jan 23, 2015
See #470

 * Based on existing support for reStructuredText files

 * Handles content files with extensions `.asciidoc` and `.ad`

 * Pipes content through `asciidoctor --safe -`.
   If `asciidoctor` is not installed, then `asciidoc --safe -`.

 * To make sure `asciidoctor` or `asciidoc` is found, after adding
   a piece of AsciiDoc content, run `hugo` with the `-v` flag
   and look for this message:

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

Caveats:

 * The final "Last updated" timestamp is currently not stripped.

 * When `hugo` is run with `-v`, you may see a lot of these messages

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

   if you have lots of `*.ad` or `*.asciidoc` files.

 * Some versions of `asciidoc` may have trouble with its safe mode.
   To test if you are affected, try this:

        $ echo "Hello" | asciidoc --safe -
        asciidoc: ERROR: unsafe: ifeval invalid
        asciidoc: FAILED: ifeval invalid safe document

   If so, I recommend that you install `asciidoctor` instead.

Feedback and patches welcome!

Ideally, we should be using https://github.com/VonC/asciidocgo,
@VonC's wonderful Go implementation of Asciidoctor.  However,
there is still a bit of work needed for asciidocgo to expose
its API so that Hugo can actually use it.

Until then, hope this "experimental AsciiDoc support through external
helpers" can serve as a stopgap solution for our community. :-)
@anthonyfok
Copy link
Member

Hi @tbrooke, @ejemba, @voxadam, @txchen, @ollin, @0xMF and @bguiz,

An experimental support for AsciiDoc has been added in Pull Request #826.
Since @VonC's excellent https://github.com/VonC/asciidocgo needs just a little bit more work before we could use it, PR #826 searches for the original Asciidoctor (written in Ruby) and pipes content through it, similar to how Hugo supports reStructuredText.

Caveat: Since Asciidoctor is not written in Go, it would be slow, but it works! :-)

There may be some quirks and idiosyncrasies, so your feedback is very welcome and very much needed. So, please try to build from source with #826 applied, and start using it in your projects, and give us feedback on what works and what don't!

Many thanks!

@bguiz
Copy link

bguiz commented Feb 2, 2015

@anthonyfok Thanks for the great work. My trivial tests so far have been OK, but it looks like @bep has done a rather comprehensive one already: #826 (comment)

@VonC I was going to say the same as what @bep said here: VonC/asciidocgo#1
As the last commit was 7-8 months ago, it looks like it is pretty stagnant, but I do not want to jump to conclusions. Are you still working on this, or would you like it to be forked?

@VonC
Copy link
Contributor

VonC commented Feb 2, 2015

@bayne Sorry, I missed @bep comment. I answered it there. TLDR; you can re-create the project.

anthonyfok referenced this issue in anthonyfok/hugo Feb 21, 2015
See #470

 * Based on existing support for reStructuredText files

 * Handles content files with extensions `.asciidoc` and `.ad`

 * Pipes content through `asciidoctor --safe -`.
   If `asciidoctor` is not installed, then `asciidoc --safe -`.

 * To make sure `asciidoctor` or `asciidoc` is found, after adding
   a piece of AsciiDoc content, run `hugo` with the `-v` flag
   and look for this message:

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

Caveats:

 * The final "Last updated" timestamp is currently not stripped.

 * When `hugo` is run with `-v`, you may see a lot of these messages

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

   if you have lots of `*.ad`, `*.adoc` or `*.asciidoc` files.

 * Some versions of `asciidoc` may have trouble with its safe mode.
   To test if you are affected, try this:

        $ echo "Hello" | asciidoc --safe -
        asciidoc: ERROR: unsafe: ifeval invalid
        asciidoc: FAILED: ifeval invalid safe document

   If so, I recommend that you install `asciidoctor` instead.

Feedback and patches welcome!

Ideally, we should be using https://github.com/VonC/asciidocgo,
@VonC's wonderful Go implementation of Asciidoctor.  However,
there is still a bit of work needed for asciidocgo to expose
its API so that Hugo can actually use it.

Until then, hope this "experimental AsciiDoc support through external
helpers" can serve as a stopgap solution for our community. :-)

2015-01-30: Updated for the replaceShortcodeTokens() syntax change
2015-02-21: Add `.adoc` extension as suggested by @Fale
@spf13 spf13 modified the milestones: v0.13, v0.14 Feb 22, 2015
@sjfloat
Copy link

sjfloat commented Mar 25, 2015

Well, it's telling me it's v0.14-DEV (I built master). And, yeah, the commit looked like it should recognize 'adoc'. Maybe I'll try a few other variations. And should the generated front matter markup be asciidoc or markdown?

anthonyfok added a commit that referenced this issue Mar 25, 2015
Commit 358dcce supposedly added ".adoc" extension recognition
for AsciiDoc, but one place was missed.

Thanks to @sjfloat for reporting the bug!
See discussions at #470.
@anthonyfok
Copy link
Member

Thanks for catching that, @sjfloat! A fix has just been committed for ".adoc" file extension recognition.
Please pull the latest HEAD from master and try again. :-)

@sjfloat
Copy link

sjfloat commented Mar 25, 2015

Will do. Thanks for jumping on that so quickly!
On Mar 24, 2015 10:33 PM, "Anthony Fok" notifications@github.com wrote:

Thanks for catching that, @sjfloat https://github.com/sjfloat! A fix
has just been committed for ".adoc" file extension recognition.
Please pull the latest HEAD from master and try again. :-)


Reply to this email directly or view it on GitHub
#470 (comment).

@sjfloat
Copy link

sjfloat commented Mar 25, 2015

Yeah, seems to work. I need to familiarize myself with Hugo before I can comment further.

@chadcurry
Copy link

Hi, very interested in using AsciiDoc for a project and curious about Hugo. Any updates on support? Is the dev version near release? Thx!

@gour
Copy link
Contributor

gour commented May 7, 2015

@anthonyfok Same as with reST support test - using Pandoc's README, although it renders (much) better, but I see in the terminal:

[...]
INFO: 2015/05/07 Rendering with /usr/bin/asciidoc ...
ERROR: 2015/05/07 exit status 1
[...]

How to get more output besides '-v' ?

@mojavelinux
Copy link

Nice work!

I noticed that you're using a regexp to extract the <body> content from the result from Asciidoctor / AsciiDoc Python. You can instruct the processor to only produce the content for the body by passing the -s flag.

I also recommend passing several attributes to the AsciiDoc processor so that authors can tailor content for the environment. Here are the attributes we've been setting (as applied to Hugo).

  • env=site
  • env-site=
  • hugo-version=x.y.z

You'd pass these as follows:

-a env=site -a env-site= -a hugo-version=x.y.z

Of course, if you find other default settings to be useful, you can consider passing those as well. If you append a @ at the end of the attribute value, you allow the page to override that setting. Otherwise, the setting is immutable.

@nickoe
Copy link

nickoe commented Jun 21, 2015

Shouldnt this issue be closed consindering that the milestone tag for this issue is v0.14 and it has been released as announced here: https://github.com/spf13/hugo/releases

@bep
Copy link
Member

bep commented Jun 21, 2015

The current implementation is only temporal (hopeful).

@nickoe
Copy link

nickoe commented Jun 25, 2015

I just tried to add an foo.asciidoc file with a frontmatter and some random chars in the content, but it will not render. The only thing I see is the title (filename) of the post. Is there any way to get more debugging? I do have a2x in my path, if that is what the temporal solution of asciidoc is using.
ERROR: 2015/06/25 exit status 1

@nickoe
Copy link

nickoe commented Jul 6, 2015

I just tried to use master, and I can render some asciidoc, but it will not upport the asciidoc include stuff and images seem to be wrong (not rendering), but I have not debugged those. This against 9b3d0cf.

@anthonyfok
Copy link
Member

Let's close this issue as we have accomplished our immediate goal, i.e. support for AsciiDoc, albeit experimental and through external Python-based (asciidoc) or Ruby-based (asciidoctor) helpers...

And open a new one for the native Go implementation of AsciiDoc support! Please continue our discussions at #1435: "Add support for native Go implementation of AsciiDoc".

@nickoe
Copy link

nickoe commented Sep 16, 2015

Except that using asciidoc does not work, although asciidoctor works.

@anthonyfok
Copy link
Member

Hi @nickoe, let's continue the discussion about asciidoc not working for your documents to Issue #1437, thanks!

tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
See gohugoio#470

 * Based on existing support for reStructuredText files

 * Handles content files with extensions `.asciidoc` and `.ad`

 * Pipes content through `asciidoctor --safe -`.
   If `asciidoctor` is not installed, then `asciidoc --safe -`.

 * To make sure `asciidoctor` or `asciidoc` is found, after adding
   a piece of AsciiDoc content, run `hugo` with the `-v` flag
   and look for this message:

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

Caveats:

 * The final "Last updated" timestamp is currently not stripped.

 * When `hugo` is run with `-v`, you may see a lot of these messages

        INFO: 2015/01/23 Rendering with /usr/bin/asciidoctor ...

   if you have lots of `*.ad`, `*.adoc` or `*.asciidoc` files.

 * Some versions of `asciidoc` may have trouble with its safe mode.
   To test if you are affected, try this:

        $ echo "Hello" | asciidoc --safe -
        asciidoc: ERROR: unsafe: ifeval invalid
        asciidoc: FAILED: ifeval invalid safe document

   If so, I recommend that you install `asciidoctor` instead.

Feedback and patches welcome!

Ideally, we should be using https://github.com/VonC/asciidocgo,
@VonC's wonderful Go implementation of Asciidoctor.  However,
there is still a bit of work needed for asciidocgo to expose
its API so that Hugo can actually use it.

Until then, hope this "experimental AsciiDoc support through external
helpers" can serve as a stopgap solution for our community. :-)

2015-01-30: Updated for the replaceShortcodeTokens() syntax change
2015-02-21: Add `.adoc` extension as suggested by @Fale

Conflicts:
	helpers/content.go
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Commit 358dcce supposedly added ".adoc" extension recognition
for AsciiDoc, but one place was missed.

Thanks to @sjfloat for reporting the bug!
See discussions at gohugoio#470.
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests