Comments (2)
Untested, but you should be able to combine an example from http://coderay.rubychan.de/ with a custom formatter.
Find and replace Lesstile::CodeRayFormatter
in the enki source with your own MyFormatter
(there are two: one for comment formatting and one for post formatting):
MyFormatter = lambda {|code, lang|
CodeRay.scan(CGI::unescapeHTML(code), lang).div(:line_numbers => :table, :css => :class)
}
(from https://github.com/xaviershay/lesstile/blob/master/lib/lesstile.rb#L77)
from enki.
Works like a dream. Thanks!
class EnkiFormatter
class << self
def format_as_xhtml(text)
Lesstile.format_as_xhtml(
text,
:text_formatter => lambda {|text| RedCloth.new(CGI::unescapeHTML(text)).to_html},
# :code_formatter => Lesstile::CodeRayFormatter
:code_formatter => lambda {|code, lang|
CodeRay.scan(CGI::unescapeHTML(code), lang).div(:line_numbers => :table, :css => :class)
}
)
end
end
end
from enki.
Related Issues (20)
- Ruby 1.9.2 compatibility and rbx-require-relative HOT 1
- Any plans to port Enki to a mountable engine? HOT 2
- Deleting comment raises ActiveRecord::RecordNotFound HOT 4
- Enki openid doesn't seem to like Google OpenID HOT 4
- undefined method `buttons` for Formtastic in admin/posts/new HOT 7
- Merge master in internationalized? HOT 5
- I can not push to Heroku HOT 2
- Support Markdown HOT 2
- Admin Login Issue HOT 1
- Change pagination to use will_paginate/kaminari instead of the Archive system? HOT 3
- Spree Integration HOT 1
- Bump to Rails 4 HOT 2
- Replace acts_as_taggable_on_steroid with alternative gem
- Turn the app into rails engine HOT 2
- session[:logged_in] isn't persisting HOT 1
- Problem with OpenID login to the admin area HOT 1
- Dot character in tag name HOT 1
- Question about Open ID being shut down HOT 11
- App breaks when comment is nil HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enki.