如何从本地Happstack服务器提供MathJax? [英] How do I serve MathJax from a local Happstack server?

查看:111
本文介绍了如何从本地Happstack服务器提供MathJax?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是开发人员/程序员.我只是试图使用 Gitit 做笔记的人.我已经知道它可以在Windows上运行,但是使用MathJax进行数学运算看起来最好.我不想依靠远程CDN来使MathJax工作(这里断电和互联网断开非常频繁).该应用程序的作者提到可以在Happstack的"4行代码"中进行设置:

I'm not a developer/programmer. I'm just someone trying to use Gitit to take notes. I've got it to the point where it runs on Windows, but the math looks best using MathJax. I don't want to rely on a remote CDN to get the MathJax working (power cuts and internet disconnections are very frequent here). The author of the app mentions it can be setup in "4 lines of code" in Happstack:

mathjax-script: https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
# specifies the path to MathJax rendering script.
# You might want to use your own MathJax script to render formulas without
# Internet connection or if you want to use some special LaTeX packages.
# Note: path specified there cannot be an absolute path to a script on your hdd, 
# instead you should run your (local if you wish) HTTP server which will 
# serve the MathJax.js script. You can easily (in four lines of code) serve
# MathJax.js using http://happstack.com/docs/crashcourse/FileServing.html
# Do not forget the "http://" prefix (e.g. http://localhost:1234/MathJax.js)

该教程的链接已断开,因此,我非常感谢您的帮助.我需要更改任何MathJax配置,还是仅提取文件就可以了?我将在gitit中写很多数学.我宁愿不设置Apache等来服务MathJax. Gitit已经使用了Happstack,我更喜欢使用它.谢谢!

The link to the tutorial is broken, so I'd be grateful for some assistance. Is there is any MathJax configuration I need to change, or simply extracting the files will do? I'll be writing lots of math in gitit. I'd prefer not to set up Apache etc. to serve MathJax. Gitit already uses Happstack, I'd prefer using that. Thanks!

为清楚起见,我不确定如何分配端口1234来服务该脚本

Just to be clear I'm not sure how to assign the port 1234 to serve this script

推荐答案

从文档中来看,static目录应该可以正常工作:

From the documentation, the static directory should work just fine:

在收到请求时,gitit总是在静态中排在第一位 目录(或在目录中为static-dir指定的任何目录中 配置文件).如果找到与请求相对应的文件 在那里,它立即被送达.如果找不到静态文件, gitit接下来在gitit数据文件的静态子目录中查找 ($ CABALDIR/share/gitit-x.y.z/data).这是默认CSS,图片, 和javascripts被存储.如果也找不到该文件, gitit将该请求视为对Wiki页面或Wiki命令的请求.

On receiving a request, gitit always looks first in the static directory (or in whatever directory is specified for static-dir in the configuration file). If a file corresponding to the request is found there, it is served immediately. If the file is not found in static, gitit next looks in the static subdirectory of gitit's data file ($CABALDIR/share/gitit-x.y.z/data). This is where default css, images, and javascripts are stored. If the file is not found there either, gitit treats the request as a request for a wiki page or wiki command.

因此,您可以投放任何您想静态投放的内容(对于 例如,静态目录中的robots.txt文件或favicon.ico). 您可以覆盖gitit的默认CSS,JavaScript或图片中的任何一个 通过将具有相同相对路径的文件放在静态文件中.笔记 该gitit具有默认的robots.txt文件,该文件不包含所有网址 以/_开头.

So, you can throw anything you want to be served statically (for example, a robots.txt file or favicon.ico) in the static directory. You can override any of gitit's default css, javascript, or image files by putting a file with the same relative path in static. Note that gitit has a default robots.txt file that excludes all URLs beginning with /_.

(来源: https://github.com/jgm/gitit )

这篇关于如何从本地Happstack服务器提供MathJax?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆