Paragraph handling is little bit tricky with tex4ht. Some information can be found in the article TeX4ht configure: Part 1.
There are two issues, if command with configuration hooks is at the beginning of the paragraph.
If some hook is inserted at the beginning of the paragraph, it must place the
tag manually, with some of commands described in the article. The code usually looks like:
\Configure{chapHook}{%
\ifvmode \IgnorePar\fi \EndP\Tg<h2 class="dvmonth">}{\Tg</h2>\IgnoreIndent}
This will include block level element with no paragraphs inside, \IgnoreIndent will cause next paragraph to have class="noindent".
For inline elements, it can look:
\Configure{sample}{\ifvmode \ShowPar\fi \HCode{<i>}}{\Tg</i>}
There is probably bug with \Tg<> command, which causes that its content gets before
tag. Solution is to use \HCode instead in the hooks which are inserted at beginning of the paragraphs.
%Wrong, gives: <i><p>
\Configure{sample}{\ifvmode \ShowPar\fi \Tg<i>}{\Tg</i>}
%Good:
\Configure{sample}{\ifvmode \ShowPar\fi \HCode{<i>}}{\Tg</i>}
Edit:
As Ulrike Fisher pointed out in comments, there are some details about configuring.
If you have some custom commands and you want to provide configurations for them, it is best to collect them in some package like mycommands.sty. Then you can provide file mycommands.4ht, which is called automatically by tex4ht when you include mycommands.sty.
For every configuration, you need to provide three things:
Create configuration hooks. This is done with
\NewConfigure{sample}{2}
This will create configuration hooks \a:sample and \b:sample.
Redefine command to include configuration hooks:
\renewcommand\sample[1]{\a:sample#1\b:sample}
Provide default configuration for hooks
\Configure{sample}{\Tg<tag name>}{\tg</tag name>}
This configuration will be then used as default.
You can redefine default configuration in custom config file, which is specified at command line when running tex4ht.
mysample.cfg:
\Preamble{xhtml, charset=utf-8}
\Configure{sample}{\Tg<another tag>}{\Tg</another tag>}
\begin{document}
\EndPreamble
To be compiled with
htlatex myfile "mysample, other options" " -cunihtf -utf8"
Last possibility to put configuration somewhere in your tex file in block that is called only when running with tex4ht
...
\@ifpackageloaded{tex4ht}{
\Configure{sample}{\HCode{<bla bla>}}{\HCode{</bbla bla>}
}{}
...
note that there are some commands disabled, like \Css and this method is best be used for testing purposes only
make sagesse_lulu.html. – raphink Aug 07 '12 at 07:37