Simple question: When I use cleveref and \Cref{} or \cref{} I am able to compile the code and produce a PDF. When I use htlatex I get ?? in place of what I expect would be the object name and section number.
Following a modified form of the the example MWE found How can I make \cref{foo,bar} from cleveref work with htlatex? as included below, I would like to figure out what the requirements to use htlatex and cleveref together are? I was sure that in the last couple of weeks trying to get this to work that I have stumbled across successfully compiled html files that included the text and number expected by a \cref{} or \Cref{} command, but never in a stable reproducible format.
\documentclass{report}
\ifdefined\HCode
\usepackage{tex4ht}
\usepackage[tex4ht]{hyperref}
\else
\usepackage{hyperref}
\fi
\usepackage{etoolbox}
\AtEndPreamble{\usepackage{cleveref}}
\begin{document}
\section{\label{foo}foo}
%\cref{bar,baz} - this won't compile but the problem is deeper rooted because cref alone doesn't work.
%\protect\cref{foo}
\cref{baz} follows \cref{bar}
\section{bar}\label{bar}
\section{baz}\label{baz}
\end{document}
I have also tried the example (slightly modified with solution incorporated) How can I make amsthm and cleveref to work with htlatex?
\documentclass{article}
\usepackage{hyperref}
\usepackage{amsthm}
\AtBeginDocument{\usepackage{cleveref}}
\newtheorem{thm}{Theorem}[section]
\newtheorem{rmk}[thm]{Remark}
\begin{document}
\begin{rmk}\label{test}
Test content
\end{rmk}
See the test found in \cref{test}
\end{document}
So in collecting enough information to understand why this isn't working, I would like to know:
Is there a
cleverefoption similar to\usepackage[tex4ht]{hyperref}that should be usedIs there a known bug or compatibility problem - Why does htlatex not work as expected?
Is there a command line option that can be added to
htlatex test.texthat is fundamental and missing (I am suspicious of this possibility because of the reference to my second example. If the solution here was to ensurecleverefis loaded last in the preamble, and my obvious issue of??appearing in place of actual references was present, then I am sure it would have been followed up.

\AtEndPreamble{\usepackage{cleveref}}or\AtBeginDocument{\RequirePackage[noabbrev]{cleveref}}seem to be incompatible with thecleveref.4htpart of your solution. Not really a big deal as it isn't hard to put the\RequirePackage{cleveref}at the end of myclsfile. – EngBIRD Jan 02 '15 at 20:32??. This particular problem is not worth isolating packages to determine which one. Thanks again for the great solution! – EngBIRD Jan 02 '15 at 20:48tex4ht?... ;) – gusbrs Jun 08 '18 at 15:35tex4htsources – michal.h21 Jun 08 '18 at 18:37\RequirePackage{cleveref}at the end of myclsfile but the problem about\eorem:syleappears (I looked atamsthm.4ht. It seems to me that this is related to the order of loading different macros (some hacking of\expandafterdepends on the order). – Yai0Phah Jun 04 '19 at 09:01cleveref.4htfile in your current file directory? I can't confirm whether updates to tex4ht in the last 5 years have made this obsolete, but I never start a project without a local copy of this file. – EngBIRD Jun 04 '19 at 22:32cleveref.4htis already there in the latest TeXLive (a lot of improvement has been made). Well, after rereading your post, it seems to me that I misunderstood your post and the example includingamsthm.4htis not what you are interested in (and you just referred to it to show the possibility of\AtEndPreamble)? I mostly have trouble with the conflict ofamsthm.4htandcleverefin tex4ht, which I thought that you have (temporarily) resolved by a trick of usingclsfile. – Yai0Phah Jun 05 '19 at 10:52