Hi, I''m just trying math blocks in webgen with kramdown, but it does not produce the same HTML as the command-line kramdown (0.10 or 0.12). in the webgen page: $$ ?e^{i\pi} = -1 $$ webgen output: <div class="math"> ?e^{i\pi} = -1 </div> command-line kramdown output: <script type="math/tex; mode=display"> ?e^{i\pi} = -1 </script> Apparently I need the MathJax library, should I load it from my templates, or will kramdown do it? Will it recognize that math class? There is no mention about this in the docs, I found it by looking at the source of the kramdown website? PS the webgen doc only mentions auto_ids as an option to the kramdown processor, but I suppose all options in the man work in some form? I also looked in the kramdown code documentation and neither Kramdown::Document::new nor Kramdown::Options mention or link to that list of possible values. -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
On 2010-11-01 23:47 +0100 Damien Pollet wrote:> Hi, > > I''m just trying math blocks in webgen with kramdown, but it does not > produce the same HTML as the command-line kramdown (0.10 or 0.12). > > in the webgen page: > $$ > ?e^{i\pi} = -1 > $$ > > webgen output: > <div class="math"> > ?e^{i\pi} = -1 > </div> > > command-line kramdown output: > <script type="math/tex; mode=display"> > ?e^{i\pi} = -1 > </script>When you use the CLI command `kramdown`, you are using the 0.12.0 version of kramdown which moved HTML math support from jsMath to MathJax. However, webgen uses kramdown 0.10.0 and is not compatible with 0.12.0 due to API changes and 0.10.0 only support jsMath.> Apparently I need the MathJax library, should I load it from my > templates, or will kramdown do it? Will it recognize that math class? > There is no mention about this in the docs, I found it by looking at > the source of the kramdown website?You will need to install MathJax yourself (about 100MB with the bitmap fonts, 8MB if you delete the bitmap fonts - note that the bitmap fonts are needed for browsers that do not support font definition downloads), this is not done by kramdown. kramdown only outputs MathJax compatible HTML tags! This means that you will need to include the necessary `<script>` tag in your template. You can look at the kramdown sources for an example, doc/default.template does exactly this.> PS the webgen doc only mentions auto_ids as an option to the kramdown > processor, but I suppose all options in the man work in some form? > I also looked in the kramdown code documentation and neither > Kramdown::Document::new nor Kramdown::Options mention or link to that > list of possible values.The kramdown option auto_ids is set by default when using kramdown through webgen. However, you can set any option support by kramdown. Have a look at http://kramdown.rubyforge.org/converter/html.html to see the options that are supported by the HTML converter! Will update the kramdown API documentation to include a list of all available options! -- Thomas
On Tue, Nov 2, 2010 at 12:25, Thomas Leitner <t_leitner at gmx.at> wrote:> However, webgen uses kramdown 0.10.0 and is not compatible > with 0.12.0 due to API changes and 0.10.0 only support jsMath.I suspected that, but I ran the webgen binary from the 0.10 gem and it printed the same as 0.12, so I was confused. Maybe gem binaries don''t necessarily use the lib of the same version??> You will need to install MathJax yourself (about 100MB with the bitmapPhew? that explains why webgen does not like it much when it''s under the src directory :)> fonts, 8MB if you delete the bitmap fonts - note that the bitmap fonts > are needed for browsers that do not support font definitionFortunately I don''t care about those :D> downloads), this is not done by kramdown. kramdown only outputs > MathJax compatible HTML tags!Which makes sense. What doesn''t is that there is zero mention of MathJax in http://kramdown.rubyforge.org/syntax.html (besides reading the HTML code :p ) -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
On 2010-11-02 14:01 +0100 Damien Pollet wrote:> On Tue, Nov 2, 2010 at 12:25, Thomas Leitner <t_leitner at gmx.at> wrote: > > However, webgen uses kramdown 0.10.0 and is not compatible > > with 0.12.0 due to API changes and 0.10.0 only support jsMath. > > I suspected that, but I ran the webgen binary from the 0.10 gem and it > printed the same as 0.12, so I was confused. Maybe gem binaries don''t > necessarily use the lib of the same version??You can run a specific kramdown version by using a special Rubygems syntax: kramdown _0.11.0_ --version kramdown _0.10.0_ --version> > You will need to install MathJax yourself (about 100MB with the > > bitmap > > Phew? that explains why webgen does not like it much when it''s under > the src directory :)Yep :-) It has to copy all of it...> > fonts, 8MB if you delete the bitmap fonts - note that the bitmap > > fonts are needed for browsers that do not support font definition > > Fortunately I don''t care about those :DMe neither ;)> > downloads), this is not done by kramdown. kramdown only outputs > > MathJax compatible HTML tags! > > Which makes sense. What doesn''t is that there is zero mention of > MathJax in http://kramdown.rubyforge.org/syntax.html (besides reading > the HTML code :p )The syntax document tries to be output agnostic (I will actually have to go through it sometime so that it really is...). So it is actually good that there is nothing written about MathJax. However, have a look at the page for the HTML converter (http://kramdown.rubyforge.org/converter/html.html) -- there you will find the information. -- Thomas