If you want to use custom TOC like list, you need to make a configuration for it. In your case, I would create sty file with your custom commands:
% cmhloc.sty
\ProvidesPackage{cmhloc}
\newcommand{\cmhcommand}[1]{\addcontentsline{cmh}{subsection}{#1}}
\newcommand{\listofcmh}{\subsection*{List of cmh}\@starttoc{cmh}}
\endinput
and corresponding .4ht file with tex4ht configurations:
cmhloc.4ht
\ConfigureToc{cmh}{\HCode{<div class="sectionToc">}}{~}{}{\HCode{</div>\Hnewline}}
\renewcommand\listofcmh{\subsection*{List of cmh}\TableOfContents[cmh]}
\endinput
In the cmhloc.4ht file, we need to do two things:
- redefine the
\listofcmh file to print our custom table of contents. It is done using \TableOfContents[cmh]
- we also need to configure styling of TOC entries, using
\ConfigureToc{cmh}. From the info output:
\ConfigureToc{unit-name} ......................4
#1 before unit number #2 before content #3 before page number #4 at end
Empty arguments request the omission of the corresponding field.
\TocCount Specifies the entry count withing the jobname.4tc
file.
\TitleCount Count of entries submitted to the toc file
An alternative to \ConfigureToc{unit-name}:
\def\toc#1#2#3{#1#2%
#3}
Example:
\ConfigureToc{section}
{}
{\Picture[*]{pic.jpg width="13" height="13"}~}
{}
{\HCode{<br />}}
We don't want to print the page numbers, so we need to leave the third parameter empty, but we need to put something to second parameter, otherwise the content text would disappear, so I've put ~ here.
I've expanded your example a little bit:
\documentclass{article}
\usepackage{cmhloc}
\begin{document}
\tableofcontents
\section{normal section}
\cmhcommand{Here is some text}
some text
\section{another secton}
\cmhcommand{Another text}
\cmhcommand{some more}
\listofcmh
\end{document}
And this is the result:

<h4 class="likesubsectionHead"><a
id="x1-40002"></a>List of cmh</h4>
<div class="tableofcontents"><div class="sectionToc"> <a
href="#x1-2001">Here is some text</a></div>
<div class="sectionToc"> <a
href="#x1-3001">Another text</a></div>
<div class="sectionToc"> <a
href="#x1-3002">some more</a></div>
</div>
Edit:
regarding your comment, you can use hyperref to link back to the TOC:
\ProvidesPackage{cmhloc}
\RequirePackage{hyperref}
\newcommand{\cmhcommand}[1]{\addcontentsline{cmh}{subsection}{#1}\hyperlink{listcmh}{#1}}
\newcommand{\listofcmh}{\subsection*{List of cmh}\hypertarget{listcmh}{}\@starttoc{cmh}}
\endinput
and the configuration:
\ConfigureToc{cmh}{\HCode{<div class="sectionToc">}}{~}{}{\HCode{</div>\Hnewline}}
% \renewcommand\listofcmh{\subsection*{List of cmh}\phantomsection\label{listcmh}\TableOfContents[cmh]}
\append:def\listofcmh{\TableOfContents[cmh]}
\endinput
I used \append:def command to just append the \TableOfContents command instead of redefining the whole macro.
List of cmhlink back to their positions -- is it possible to link from the position to the place inList of cmh? – cmhughes Sep 22 '17 at 12:13\cmhcommandcould link to its relevant place in theList of cmh. The idea is to have bi-directional links. I'd be happy to open a new question, if you feel it's a separate issue from that originally described. – cmhughes Sep 22 '17 at 17:11