tex4ht has options to create cross links betweens html pages, depending on the cut level.

Current cross-links can create next/previous/up, ... buttons and has several options to customize them.

I wanted to know if it is possible - instead of these cross links - to show the navigation as a "tree", showing only the current branch.

Example, let's say we have the following document structure

Documentation - Table of content

Chapter 1 - Overview

Section 1.1 - Introduction

Chapter 2 - Software

Section 2.1 - Drivers

Sub-section 2.1.1 - Ethernet driver

Sub-section 2.1.2 - USB driver

And that tex4ht is used to generate HTML pages split at subsection level.

When viewing the page "Ethernet driver", I would like to see at the top:

documentation > 2. Software > 2.1 Drivers > 2.1.1 Ethernet driver

Each item being a link to the related page.

Is there any standard way to do it using tex4ht or should I plan some post-processing to build that manually?

There is no standard way to do it in tex4ht, but it is possible to do it using some hacks. Try the following configuration file:

 \Preamble{xhtml}
% \TocAt{likechapter,chapter,likesection,section,likesubsubsection,subsection}
\makeatletter
\def\getsection#1{
\expandafter\def\csname toc#1\endcsname##1##2##3{
\edef\@tempa{##1}
\edef\@tempb{\csname the#1\endcsname}
\ifx\@tempb\@tempa \textgreater ##1\ ##2\fi}
}
\makeatother
\def\resetsections{%
\def\doTocEntry{\ifx\tempa\@empty\fi}
\def\tocpart{}
\def\toclikepart{}
\def\tocchapter{}
\def\toclikechapter{}
\def\tocsection{}
\def\toclikesection{}
\def\tocsubsection{}
\def\toclikesection{}
}
\bgroup\resetsections\getsection{chapter}\getsection{part}\getsection{section}\getsection{subsection}%
\HCode{<a href="\jobname.html">Main</a>}\IfFileExists{\jobname.4ct}{\input{\jobname.4ct}}{}
\egroup%
}
\begin{document}
\EndPreamble


we erase default crosslinks definition using \Configure{crosslinks*}{}, then we request call to \breadcrumbs macro in crosslinks+ configuration.

\breadcrumbs macro is little bit hacky. We exploit the TOC file generated by tex4ht, which is named \jobname.4ct. It looks like this:

\expandafter\ifx\csname doTocEntry\endcsname\relax \expandafter\endinput\fi
\par


we call macro \resetsections, in which we declare macros which may be containted in the .4ct file to do nothing, then using \getsection, we request testing if the included chapter, section and subsection equals to the current sectioning numbers. If they do, then they are printed.

A sample file:

\documentclass{book}

\begin{document}
\part{Documentation}
\chapter{Overview}

\section{Introduction}

\chapter{Software}

\section{Drivers}

\subsection{Ethernet driver}

\subsection{USB driver}
hello world
\end{document}


The result:

• Thanks for that answer! I gave it a try, and forgot that I had also several \part in the structure. Using your cfg file gives weird result when taking in account parts. I came with an alternative solution using a bash script with awk and string substitions to do the job. Jun 30 '16 at 12:19
• @Blake_ch it is quite easy to add support for parts as well, see the updated answer Jun 30 '16 at 14:17
• The generated links for parts do not match the structure with your proposal. Imagine you have \part{x} before \chapter{x} in the above structure, the links for part II Software will show Main > 1 Overview > 1.1 Introduction > II Software. I couldn't find how to fix this Jul 4 '16 at 14:13
• @michal.h21 Please could you provide the .tex file? Thanks in advance! Dec 1 '16 at 11:21
• @Arianna sure, please see the updated answer Dec 1 '16 at 14:00