Module: MarkdownServer::Plugin

Included in:
MarkdownServer::Plugins::BibleCitations
Defined in:
lib/markdown_server/plugin.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
10
# File 'lib/markdown_server/plugin.rb', line 7

def self.included(klass)
  PluginRegistry.register(klass)
  klass.extend(ClassMethods)
end

Instance Method Details

#browser_render(relative_path, real_path, app) ⇒ Object

Hook: claim a file for custom popup rendering in /browser Return { type:, title:, … } hash or nil to pass



39
# File 'lib/markdown_server/plugin.rb', line 39

def browser_render(relative_path, real_path, app) nil end

#post_render(html, meta, app) ⇒ Object

Hook: post-process rendered markdown HTML (runs after render_markdown)



35
# File 'lib/markdown_server/plugin.rb', line 35

def post_render(html, meta, app) html end

#process_fetch(url, html, app) ⇒ Object

Hook: claim a /fetch URL — return { title:, html: } hash or nil to pass



32
# File 'lib/markdown_server/plugin.rb', line 32

def process_fetch(url, html, app) nil end

#setup(config) ⇒ Object

Called once at startup with resolved config hash



23
# File 'lib/markdown_server/plugin.rb', line 23

def setup(config) end

#transform_html(html, app = nil) ⇒ Object

Hook: transform raw HTML (runs on .html files before popup injection)



29
# File 'lib/markdown_server/plugin.rb', line 29

def transform_html(html, app = nil) html end

#transform_markdown(text) ⇒ Object

Hook: transform raw markdown text (runs before wiki links + Kramdown)



26
# File 'lib/markdown_server/plugin.rb', line 26

def transform_markdown(text) text end