jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.03k stars 3.35k forks source link

pandoc 1.13.2: --mathjax -s does not call the proper javascript address #1920

Closed numenic closed 9 years ago

numenic commented 9 years ago

Hello,

latest release installed using cabal.

$ pandoc --version
pandoc 1.13.2
Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1.
Syntax highlighting is supported for the following languages:
    abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, c,
    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua, dtd,
    eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler, go,
    haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json, jsp,
    julia, latex, lex, lilypond, literatecurry, literatehaskell, lua, m4,
    makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
    metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
    objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php, pike,
    postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest, rhtml,
    roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
    sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
    yacc, yaml, zsh
Default user data directory: /home/nic/.pandoc
Copyright (C) 2006-2014 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

Create a "test.pdc" file:

$ cat test.pdc
test
----

$\sigma = \frac{M_f.\nu}{I}$

Call pandoc using mathjax and standalone params:

$ ~/Bureau/test$ pandoc --mathjax -s test.pdc -o test.html

The mathjax address is not properly called. The equation is thus not rendered at all in the browser:

$ head test.html
[...]
<script src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
</head>

Adding "http:" to the beginning of src fix the issue

mpickering commented 9 years ago

See #1847

jgm commented 9 years ago

@mpickering, given the number of queries we get about this issue, we might want to reconsider the decision to use the protocol-relative URL in the default template.

This was added in response to jgm/pandoc-templates#67 (which is mistakenly still open). But I think we probably optimized for the wrong use case. It is probably more common for people to want to view files locally in the browser than serve them on https. In any case, whichever default we use, the other setting is easy to specify on the command line with --mathjax.

mpickering commented 9 years ago

I was thinking the same but I couldn't comment how useful people found the change. It seems like http or https would be a better default with a note in the README.

cben commented 9 years ago

I don't see any downside to defaulting to https://cdn.mathjax.org. It will work from a document viewed via http:, https: and local file:. IIUC the only reason the protocol-relative form was once popular is an optimization to avoid TLS overhead for people that "didn't ask for it", but the overhead has reduced, encrypting everything is a Good Thing so it's going out of fashion [see update http://www.paulirish.com/2010/the-protocol-relative-url/]. More importantly, a default where file:// works seems clearly better to me than a default where http:// is marginally faster. Power users can always give an explicit URL but defaults should Just Work.