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

Add syntax highlighting for asciidoc #280

Closed
mojavelinux opened this issue Mar 1, 2012 · 15 comments
Closed

Add syntax highlighting for asciidoc #280

mojavelinux opened this issue Mar 1, 2012 · 15 comments

Comments

@mojavelinux
Copy link

Add syntax highlighting to [source] blocks using the pygments syntax highlighting engine.

In order to support this, the [source] blocks need to be honored. Currently, this markup breaks the rendering:

[source,python]
----
''' A multi-line
    comment.'''
def sub_word(mo):
    ''' Single line comment.'''
    word = mo.group('word')   # Inline comment
    if word in keywords[language]:
        return quote + word + quote
    else:
        return word
----
@atmos
Copy link
Contributor

atmos commented May 6, 2012

Is there a specific version of asciidoc that we need to support this?

@mojavelinux
Copy link
Author

It appears the pygments filter was added in 8.6.0 according to the changelog.

http://www.methods.co.nz/asciidoc/CHANGELOG.html#_version_8_6_0_2010_08_16

The source highlight block itself seems to have been added in 7.0.3, but at that time only used gnu source-highlight. The pygments filter, IMO, is far more flexible.

I personally use asciidoc 8.6.6 (meaning the version I'm most familiar with).

@atmos
Copy link
Contributor

atmos commented May 7, 2012

Yup, it looks like we run 8.4 in production but everything passes locally on 8.6.7. I'll see about getting production updated.

@mojavelinux
Copy link
Author

Awesome!

@balunasj
Copy link

Would this fix all asciidoc files in github repo's, or just in the wiki's? We're running into this problem too, and it would be awesome it if was fixed.

Our options are leave it as is

  • Breaks in github view
  • Works when generated locally

or remove the [source,foo]

  • Removes all syntax highlighing both in github, and local builds
  • Shows as a code block though

@bootstraponline
Copy link
Member

Upgrading asciidoc should fix it everywhere as both Gollum and the regular repo rendering rely on github/markup.

@balunasj
Copy link

Excellent! Any estimated timeframe for this? I'm not rushing, just want to decide on which option to go with from my post above :-)

@haad
Copy link

haad commented Jul 19, 2012

hmmm am I guessing right that this doesn't work for anyone yet ? I have just looked at this issue briefly and there are 2 things that needs to be done.

  1. Markup right now uses this command to convert asciidoc to html

asciidoc -s --backend=xhtml11 -o - -

This needs to be changed because we need to add this line to asciidoc config

source-highlighter=pygments

  1. markup needs to have a way how to add more configuration options to cmd lines which it use to convert files.

@bootstraponline
Copy link
Member

@balunasj I have no idea what GitHub's plans are, however I wouldn't expect it anytime soon.

@haad You're likely correct that it doesn't work yet.

@haad
Copy link

haad commented Jul 20, 2012

please see github/markup#145

You can use my fork of markup it works there with gollum, until they merge it to main repo.

@dometto
Copy link
Member

dometto commented Dec 23, 2014

Sorry for the wait everyone. Asciidoc syntax highlighting (through the default highlighter Rouge, or Pygments if it is installed) is implemented in this PR, which will be part of the next minor release of gollum-lib. Note that this is only in the open source gollum app (which has diverged from github.com).

@dometto dometto closed this as completed Dec 23, 2014
@dometto
Copy link
Member

dometto commented Jan 4, 2015

Now implemented as part of gollum-lib master: gollum/gollum-lib#128

@craibuc
Copy link

craibuc commented Jan 19, 2015

Is this an accurate statement?

This might be a source of confusion to some people.

If so, it might make sense to add this to gollum-lib's documentation (I'm happy to help with that).

@dometto
Copy link
Member

dometto commented Jan 19, 2015

That would appear to be accurate. :) Gollum does its own syntax highlighting (through Rouge or Pygments), superceding the behavior of the underlying markup renderer. So asciidoc syntax blocks will still be rendered by Rouge by default, courtesy of gollum-lib. That also means you can use github-style codeblocks no matter what markup/renderer you are using.

If that's unclear in the readme or wiki, please point it out to us (or open a pull request/edit it yourself)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants