Please imagine that the plugin adds some custom BBCode tags, or wraps any text with a custom HTML tag for later use, such as decorating it. I don’t want it to take effect outside the first post (or based on other conditions), since I don’t need it and it may cause some side effects.
Also, I may have found a possible solution on the server side. It wraps the cook method of the Post model. I haven’t tested it yet.
class ::Post
# wrap the original cook method to add features option
# see the markdown method in lib/pretty_text.rb
alias_method :original_cook, :cook
def cook(raw, opts = {})
features = {
'feature-name': is_first_post?
}
if opts.has_key?(:features)
opts[:features].merge!(features)
else
opts[:features] = features
end
original_cook(raw, opts)
end
end