I am using "emacs 24.4.1; htmlfontify 0.21" and try to htmlfontify a ansi-term buffer. But the style in the generated HTML file does not contain colors. This is how it looks:

span.term-bold-0004   { font-size: 105%;  text-decoration: none; }
span.term-bold-0004 a { font-size: 105%;  text-decoration: underline; }
span.term-bold-0006   { font-size: 105%;  text-decoration: none; }
span.term-bold-0006 a { font-size: 105%;  text-decoration: underline; }
span.term-bold-0003   { font-size: 105%;  text-decoration: none; }
span.term-bold-0003 a { font-size: 105%;  text-decoration: underline; }
span.term-bold-0007   { font-size: 105%;  text-decoration: none; }
span.term-bold-0007 a { font-size: 105%;  text-decoration: underline; }

When I htmlfontify a source file the CSS contains the colors:

span.function-name   { color: #0000ff;  font-family: Lucida Console;  font-stretch: semi-condensed;  font-weight: 500;  font-style: normal;  background: #ffffff;  font-size: 14pt;  text-decoration: none; }

What do I have to do to get the colors from the ansi-term right?

  • I have a major conceptual problem understanding what you are trying to do. Ansi-term is a kind of shell. Shells allow customization of ansi sequences which do things like make text bold, or underlined and have a foreground and background color. htmlfontify is for HTML text which isn't the same as a buffer containing shell interaction.
    – rocky
    Oct 16, 2015 at 22:45
  • 1
    @rocky htmlfontify is not for HTML, it generates HTML. I would like to generate HTML from a colored ansi-term buffer in order to show the colors in a blog.
    – ceving
    Oct 19, 2015 at 10:45
  • this is still too vague and there are misconceptions about what's supposed to happen. I suspect that's why no one is commenting on or answering your question. When I run htmlfontify on an ansi-term there are some CSS definitions, specifically for span.default and span.term. "span.term-bold a" never has color unless but you can customize that if you want to include color using M-x customize-variable hfy-src-doc-link-style.
    – rocky
    Oct 19, 2015 at 12:34
  • 1
    @rocky The colors are in the buffer, because it is either red or blue or magenta. Is it really necessary to customize this once again just for the HTML export?
    – ceving
    Oct 20, 2015 at 7:47
  • To me the question is clear and useful. The OP has an ansi-term buffer in emacs that shows color. They want to save that into a file readable by some other program. HTML is a natural export format for portable text with color information. The OP is rightfully surprised that doing that works for source code and not for ansi-term buffers. May 15, 2020 at 9:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.