Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
593 views
in Technique[技术] by (71.8m points)

header label in doxygen markdown page makes header title disappear

I notice a strange problem with doxygen 1.8.2. Including a header label causes the header title to disappear from the output html.

With the following markdown file:

Title            {#title}
=====

Section 1        {#section1}
---------
Text for section 1

I get the output as:

Title

Text for section 1

But, if I remove the {#section1} label from the markdown file, I get the correct output as:

Title

Section 1

Text for section 1

What is the mistake I am making here?

Edit I observed the following warning when I label a section:

 warning: found subsection command outside of section context!
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After some investigation, I have decided this appears to be a bug, but only because it is slightly counter-intuitive.

Consider the following:

The Main Section {#the_main_section}
================

Subsection One {#first}
--------------

Something highly interesting...

The document starts with a level 1 header (as described here) and so Doxygen parses "The Main Section" as the name and title of the page. The header and the label {#the_main_section} appear to be disregarded once the header has been converted into a page name.

The processing then moves on to the rest of the document and When it reaches "Subsection One", it believes that there is no parent "Section" for the "subsection" (as the "Section" was converted to a page name) and this is where it chokes.

More specifically, it discards the subsection (header) as it believes there is no parent "section". All other text remains, but is treated as part of the "page" (with no section parent).

The "fix" is to add another "level 1 header" after the initial "level 1 header" e.g.

My Great Documentation (Which Becomes the Page Name)
====================================================

The First Section
=================

Q. What? I already created a level 1 heading?
A. Yup, but that was converted to a page name/title and discarded, so now
   we have to create another level 1 heading for my first section. Don't
   be fooled into thinking that the opening heading in this document is
   still treated as an opening heading by Doxygen - it's not!

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...