Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I' m testing on this post' s method

I found some problems.

Export["test.html", nb = EvaluationNotebook[], "HTML",  
    "ConversionRules" -> {"Input" -> {"<pre><code>", DisplayForm[#] &, "/code>/pre>"}},
    CharacterEncoding -> "CP936", "CSS" -> None]

Export["test.html", nb = EvaluationNotebook[], "HTML",  
     "ConversionRules" -> {"Input" -> {"<pre><code>", InputForm[#] &, "</code>/pre>"}},  
     CharacterEncoding -> "CP936", "CSS" -> None]

enter image description here

How can I keep the Codes completely the same as that in the Notebook?

Are there any easy ways to do that? For example, change the DisplayFormula[#]& into something else that I don't know?

share|improve this question
up vote 4 down vote accepted

This thing could be done by the option "MathOutput"->"InputForm", However I'm not sure whether this can entirely solve the question(need more tests).

Export["test.html", nb = EvaluationNotebook[], "HTML",  
       "ConversionRules" -> {"Input" -> {"<pre><code>", "</code></pre>"}}, 
       CharacterEncoding -> "CP936", "CSS" -> None,"MathOutput"->"InputForm"]

enter image description here

Merge two Input Cell(Or type by Enter, there is a "\n" in the cell Expression), and follow the method in the above then still generate images in the HTML files. (How to make this Input Cell become text in the html files?)

enter image description here

share|improve this answer
I have resized last image, feel free to undo this if you like. – Kuba Aug 23 '13 at 7:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.