Module: Kramdown::Latexish
- Defined in:
- lib/kramdown/latexish/version.rb,
lib/kramdown/latexish/bibliographical.rb,
lib/kramdown/latexish/lexical.rb,
lib/kramdown/latexish.rb
Defined Under Namespace
Modules: Bibliographical Classes: Lexical
Constant Summary collapse
- VERSION =
"1.0.3"
Class Method Summary collapse
-
.taylor_options(options) ⇒ Object
The extra options to pass to Kramdown::Document to make it correctly parse and convert the mathematical articles we target.
Class Method Details
.taylor_options(options) ⇒ Object
The extra options to pass to Kramdown::Document to make it correctly parse and convert the mathematical articles we target. The instantiation should therefore always be done as the equivalent of
options = { ... }
...
options = Kramdown::Latexish::taylor_options(options)
doc = Kramdown::Document.initialise(source, options)
It will override :input and :auto_ids, so setting those in ‘options` is useless, and potentially confusing.
Why this design instead of creating a document class inheriting ‘Kramdown::Document`? The reason stems from a common use case, examplified by static website generators such as Nanoc or Middleman. The user code does never directly instantiate a document. Instead it calls a method from Nanoc or Middleman, which will in turn instantiate a document. The problem is that this object is not visible to the client code. However Nanoc and Middleman let client code pass options to initialise the document. Hence the present design. The only alternative would have been to monkeypatch Kramdown::Document but we think it is cleaner to avoid doing that.
493 494 495 |
# File 'lib/kramdown/latexish.rb', line 493 def self.() .merge({:input => 'Latexish', :auto_ids => false}) end |