Comments (5)
Looked at the code more and realized you currently have to define your custom filters in the Gollum::Filter::
namespace:
gollum-lib/lib/gollum-lib/markup.rb
Line 159 in 1058d36
It might also be nice to allow implementors to stay out of the Gollum namespace like in my example above?
from gollum-lib.
It might also be nice to allow implementors to stay out of the Gollum namespace like in my example above?
I personally think it's neat to have all filters be part of the same namespace, but if the consensus is this is very counter intuitive I am happy to yield. :) Substantively it would only require modifying the line you quote, I think. Something like:
filter_sym.is_a?(Class) ? fiter_sym.new(self) : Gollum::Filter.const_get(filter_sym).new(self)
But my personal feeling is this complicates the code for a minimal gain in enduser-friendliness. Perhaps it's more important that we document clearly how to define a custom filter?
from gollum-lib.
Sorry @beporter, I just realized I never responded to this more verbosely. I do really like the example snippet you give and we would be open to considering a PR that makes something like that possible! If I see things correctly, that functionality would be independent of the namespace issue, no?
Thanks for chipping in regardless!
from gollum-lib.
No worries on timing!
And yes I believe it would remove the current namespacing requirement. EDIT: I may have interpreted this wrong. JUST making the default list a constant would NOT remove the namespace requirement without the additional snippet you suggested. I'm happy to compromise to at least enable the prepend/append functionality.
Quite similarly to you: I'm quite happy to do a PR, but no promises on timing. The nature of open source work is that sometimes it's months between good opportunities to meaningfully contribute. I have a gollum search plugin still sitting on the back burner too. 🤦♂️
from gollum-lib.
JUST making the default list a constant would NOT remove the namespace requirement without the additional snippet you suggested. I'm happy to compromise to at least enable the prepend/append functionality.
Right, so there seem to be two options:
- Add the snippet and be able to do
Gollum::Wiki::DEFAULT_FILTERS + [ My::CustomFilter ]
- Don't add the snippet and only be able to do
Gollum::Wiki::DEFAULT_FILTERS + :MyCustomFilter
, whereMyCustomFilter
is under theGollum::Filter
namespace
I'm alright with either approach, 1 means more flexibility for the end user, whereas 2 is less complex in our codebase. My own initial preference was for one, but I'm happy to yield.
By the way, since the order of execution for the filters is important, I guess a typical usage would be something like:
Gollum::Wiki::DEFAULT_FILTERS.insert(Gollum::Wiki::DEFAULT_FILTERS.rindex(:Code), My::CustomFilter)
Maybe we could even come up with a more user friendly solution for that.
And: absolutely understand about the timing! Thanks for taking the time to contribute.
from gollum-lib.
Related Issues (20)
- sanitize lib needs update (CVE-2018-3740) HOT 4
- Recent versions of sanitize break jruby HOT 1
- Depends on an old version of sanitize HOT 14
- Make file search case insensitive HOT 1
- 5.x: TOC doesn't show up in subpages HOT 2
- Set commit date on committing changes HOT 12
- Gollum should register ".adoc" as a valid file extension for AsciiDoc
- Series macro can't be used in subpages
- pandoc-citeproc no longer supported HOT 2
- Improve Navigation or TOC.
- Make dependency on twitter optional HOT 1
- markups @master still referring to python2 for rst support HOT 2
- More efficient sanitization
- Customization (like sorting and filtering) of the navigation or TOC macros? HOT 1
- Default CommonMarker options?
- Advanced search HOT 5
- Add page categorization (or concept tagging) feature HOT 8
- Macro filter turned boolean arguments into string HOT 2
- Rethink logic for Macro sanitization HOT 2
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 gollum-lib.