Code Monkey home page Code Monkey logo

moxygen's Introduction

Moxygen

Moxygen is a Doxygen XML to Markdown converter for C++ developers who want a minimal and beautiful solution for documentating their projects.

Moxygen is currently used in conjunction with GitBook to generate the API documentation for LibSourcey.

Features

  • Multi page output: Output single or multiple files
  • Internal linking: Anchors in comments and function definitions are supported
  • Markdown comments: Markdown in Doxygen comments are rendered
  • Doxygen groups: Doxygen grouping is supported for more organised documentation
  • Custom templates: Modify the core Markdown templates to add your own flavour
  • Optional index: Optionally render a top level index

Usage

  1. Add GENERATE_XML=YES to your Doxyfile first.
  2. Run doxygen to generate the XML documentation.
  3. Install moxygen like so: npm install moxygen -g.
  4. Run moxygen providing the folder location of the XML documentation as the first argument ie. {OUTPUT_DIRECTORY}/xml.
Usage: moxygen [options] <doxygen XML directory>

Options:

  -V, --version          output the version number
  -o, --output <file>    output file, must contain "%s" when using `groups` or `classes`
  -g, --groups           output doxygen groups into separate files
  -c, --classes          output doxygen classes into separate files
  -p, --pages            output doxygen pages into separate files
  -n, --noindex          disable generation of the index, ignored with `groups` or `classes`
  -a, --anchors          add anchors to internal links
  -H, --html-anchors     add html anchors to internal links
  -l, --language <lang>  programming language
  -t, --templates <dir>  custom templates directory
  -L, --logfile [file]   output log messages to file
  -q, --quiet            quiet mode
  -h, --help             output usage information

Multi-page Output

Moxygen supports the doxygen groups syntax for generating multi page documentation. Every \defgroup in your source code will be parsed and output into a separate markdown file, with internal reference updated accordingly.

Example:

moxygen --anchors --groups --output api-%s.md /path/to/doxygen/xml

Example

To get a feel for how Moxygen works you can play with the example which is located in the example folder. The example contains:

  • Documented C++ example code
  • A Doxyfile file (for doxygen 1.8.13)
  • Pre-generated XML output in example/xml
  • Pre-generated output Markdown files in example/doc

To fully build the example, follow these steps (once you've installed doxygen. See Development & Contribution, below):

  1. Rebuild the XML: run doxygen from within the example folder.
  2. Rebuild the Moxygen output: from within this directory,
node bin/moxygen.js --groups --pages --anchors --output=example/doc/api-%s.md example/xml

Development & Contribution

You can develop this project as you would any other Node project:

  1. Clone this repo.
  2. npm install from this directory.

This project is tested through integration, by building the example/. To quickly test this project:

  1. Install doxygen (brew install doxygen, choco install doxygen, for example). Only must be done once per computer.
  2. npm test from this directory. This will run Doxygen on the example/ and build the output.

moxygen's People

Contributors

auscaster avatar cankar001 avatar citelao avatar coliff avatar elod avatar junyixiao avatar laffan avatar ledif avatar naumazeredo avatar ntonnaett avatar saulozitos avatar tonykero avatar vigsterkr avatar wvenialbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moxygen's Issues

Support outputting individual files per compound

Not sure whether I got it right, but it looks as if moxygen cannot output a separate file for each compound currently. E.g. I'd like to render a file for each class. Am I missing something?

Cannot set property 'groupid' of undefined

Trying to run your moxygen --anchors --groups --output api-%s.md from README,
getting

TypeError: Cannot set property 'groupid' of undefined
at Object. (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/src/parser.js:344:34)
at Array.forEach ()
at Object. (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/src/parser.js:340:33)
at Array.forEach ()
at Object.parseCompound (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/src/parser.js:328:30)
at Object. (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/src/parser.js:445:16)
at Array.forEach ()
at Object. (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/src/parser.js:443:14)
at Object. (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/src/parser.js:474:9)
at Parser. (/home/ricardo/.nvm/versions/node/v8.11.4/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:306:18)

Anchors in markdown

i noticed the anchors (refs) are converted to {#refid} in markdown and was wondering if that is some de-facto syntax, or why it is done that way. i am using remark to convert the mds to html, but it does not seem to be supporting it. a quick search also didn't yield any common agreed pattern to use, other than effectively pushing <a name/id="refid"></a> into the md content. would you approve a pr doing that?

no space between keyword and name

In the summary, keywords such as define, enum, and class, don't have a space before the name e.g. classClass instead of class Call.

Tag a git release

Hi,
could you please tag a new git release? This way moxygen can be easier packaged for several Linux distributions. I am interested in packaging it for Arch Linux.

Please also consider to gpg sign your release for verifying the authenticity of the source. You could use gpgit which automates everything in a single, simple bash script.

Thanks
~Nico

Can't generate private members

Hi,
I use your awesome library at work to document my project.
I'm currently facing an issue :
My project contains some CSharp classes with XML Comments.
Doxygen seems to generated properly private members for these classes,
but I can't find how to generated them in moxygen.

Here a repository I've just create with a sample example

Creating index file

I see a feature mentioned "Optional index: Optionally render a top level index" but i dont see a way to
create top level index file from the generated markdown. It can generate pages, classes, groups or everything in a single md file.

Missing tags implementation

As pages can now be generated, there is a need in implementing missing tags, because pages are more detailed, descriptive & general-purpose. By testing against Urho's and SFML's doc i found some tags that are needed to be transformed into markdown, and not just ignored & kept in plain text:
here is a few of some that i encountered and worked on locally.

tagname Markdown Equivalent (Proposal) Seen at
verbatim raw codeblock https://urho3d.github.io/documentation/1.7/_building.html#Build_Scripts
title Equivalent to headings https://www.sfml-dev.org/documentation/2.4.2/
"Welcome" "Short Example"
linebreak 2 spaces common
varlistentry (followed by listitem) two-row table https://www.sfml-dev.org/documentation/2.4.2/deprecated.php
The whole document is a variablelist, containing varlistentry strictly followed by a listitem
term bold equivalent https://www.sfml-dev.org/documentation/2.4.2/deprecated.php
each "Class" "Member" + arguments of the prototype

Special Characters:

there are also other types of anchor tags comparable to "ref", like "anchor" and "sectX" (where X = 1,2,3 ..)

For now i'm testing Doxygen XML and moxygen's output by checking the official rendered version of well-known projects documentations, i think it would be great to have testing documents (from doxygen testing at first, and then develop a fine-grained testing suite)

support for unions

It looks like unions cannot be rendered at the moment. I'm trying to document a firmware project which contains a lot of unions, and I get many warnings along the lines of:

warn: cannot render union <union_name>

Looking at the code, it looks to just be a missing switch case statement. I haven't looked into fixing this myself as I'm not very familiar with javascript. I hope it's an easy fix though!

Cyrillic characters in markdown table's titles

I use comments in c++ files +doxygen in xml +moxygen and I have a problem with tables in result md file. Their titles are cuts.
Example of my table:

    //! |Подрежим | Действие
    //! |---------|---------
    //! |Inform1  |Inform2

Result: title2 is missing (see result1.jpg)

    //! |Подрежим | Действие
    //! |---------|------------------
    //! |Inform1  |Inform2

Result: title2 is cut (see result2.jpg)

    //! |Подрежим | Действие
    //! |---------|--------------------------
    //! |Inform1  |Inform2

Result: ok (see resultOK.jpg)
For each Cyrillic character I have to use 2 '-'
result1
result2
resultok

TypeError: Cannot read property 'compound' of undefined

Hi, moxygen give me an error:

except that doxygen/doxypress, every other alternative complex and didn't worked.
sphinx+breathe+doxygen is too difficult to understand.

verbose: Parsing xml\index.xml
events.js:163
throw er; // Unhandled 'error' event
^

TypeError: Cannot read property 'compound' of undefined
at Object. (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\src\parser.js:379:50)
at Parser. (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\xml2js\lib\xml2js.js:489:18)
at emitOne (events.js:96:13)
at Parser.emit (events.js:191:7)
at SAXParser.onclosetag (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\xml2js\lib\xml2js.js:447:26)
at emit (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\sax\lib\sax.js:640:35)
at emitNode (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\sax\lib\sax.js:645:5)
at closeTag (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\sax\lib\sax.js:905:7)
at SAXParser.write (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\sax\lib\sax.js:1452:13)
at Parser.exports.Parser.Parser.parseString (C:\Users\xxx\AppData\Roaming\npm\node_modules\moxygen\node_modules\xml2js\lib\xml2js.js:508:31)

C 11/17/23 template

Support for plain 'ol C would be a nice feature. I'm going to see what happens if I use the C++ parser, but I was surprised to see C was not a supported language–since it's mostly just a subset of C++.

Use dash in links?

Using dash in internal links would make them work even without the -a option when using markdown preview of GitHub, GitLab, VS Code etc.

TypeError: Cannot read property 'forEach' of undefined

Output where Moxygen crashes:

verbose: Processing compound c74::min::attribute
verbose: Processing member m_value
verbose: Processing member m_range_args
verbose: Processing member m_range
verbose: Processing member m_enum_map
verbose: Processing member m_helper
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member assign_from_argument
verbose: Processing member handle_arguments
verbose: Processing member handle_arguments
verbose: Processing member copy_range
verbose: Processing member copy_range
events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'forEach' of undefined
    at Object.parseMember (/usr/local/lib/node_modules/moxygen/src/parser.js:176:47)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:293:22)
    at Array.forEach (native)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:288:33)
    at Array.forEach (native)
    at Object.parseCompound (/usr/local/lib/node_modules/moxygen/src/parser.js:278:30)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:368:16)
    at Parser.<anonymous> (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/xml2js.js:489:18)
    at emitOne (events.js:96:13)
    at Parser.emit (events.js:188:7)

Presumably this is the source code on which it is choking. There are only two implementations of the copy_range() method:

	template<class T, threadsafe threadsafety>
	void attribute<T,threadsafety>::copy_range() {
		range_copy_helper<T,threadsafety>(this);
	};
		
	template<>
	void attribute<std::vector<double>>::copy_range() {
		if (!m_range.empty()) {
			// the range for this type is a low-bound and high-bound applied to all elements in the vector
			assert( m_range_args.size() == 2);
			
			m_range.resize(2);
			m_range[0][0] = m_range_args[0];
			m_range[1][0] = m_range_args[1];
		}
	};

Moxygen Error - "TypeError: Cannot read property 'match' of undefined"

Hey guys, am I doing something wrong?

Moxygen works fine with my ObjectiveC codebase's doxygen output, but not for my Android (Java)

I can remove some of the files and change the error, but I have too many files - it would be better just to be told the error so that I can fix it.

Any help/debugging instructions would be super 👍

last verbose statement: (pretty standard output up until here)

verbose: Processing member function [static initializer]

the stacktrace:

events.js:167
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'match' of undefined
    at Object.parseMember (/usr/local/lib/node_modules/moxygen/src/parser.js:230:48)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:358:22)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:347:33)
    at Array.forEach (<anonymous>)
    at Object.parseCompound (/usr/local/lib/node_modules/moxygen/src/parser.js:335:30)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:445:18)
    at Parser.<anonymous> (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:303:18)
    at Parser.emit (events.js:182:13)
    at SAXParser.onclosetag (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:261:26)
Emitted 'error' event at:
    at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:326:16)
    at Parser.parseString (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:5:59)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:460:17)
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

Option to generate one .md file per class/struct

This is a great project but I'd prefer my docs to take the form of one class (or compound) == one page, and one group page just links to the class pages.

Would that be an easy thing to add?

Test fails

$ uname -a
Linux hostname #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux

Then:

$ git clone https://github.com/sourcey/moxygen
$ cd moxygen/
$ npm install
$ npm audit fix --force
$ npm --version
10.5.0
$ sudo npm install -g [email protected]

Then:

$ npm test

> [email protected] test
> npm run clean && cd example/ && doxygen && cd .. && node bin/moxygen.js --groups --pages --anchors --output=example/doc/api-%s.md example/xml


> [email protected] clean
> rm -rf example/doc/*.md example/xml/

warning: Tag 'TCL_SUBST' at line 247 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1089 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'LATEX_SOURCE_CODE' at line 1794 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'RTF_SOURCE_CODE' at line 1876 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOCBOOK_PROGRAMLISTING' at line 1974 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'PERL_PATH' at line 2154 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'CLASS_DIAGRAMS' at line 2167 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'MSCGEN_PATH' at line 2176 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Doxygen version used: 1.9.4
Searching for include files...
Searching for example files...
Searching for images...
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /tmp/moxygen/example/src
Reading and parsing tag files
Parsing files
Preprocessing /tmp/moxygen/example/src/bicycle.cpp...
Parsing file /tmp/moxygen/example/src/bicycle.cpp...
Preprocessing /tmp/moxygen/example/src/bicycle.h...
Parsing file /tmp/moxygen/example/src/bicycle.h...
Reading /tmp/moxygen/example/src/changelog.md...
Preprocessing /tmp/moxygen/example/src/mountainbike.cpp...
Parsing file /tmp/moxygen/example/src/mountainbike.cpp...
Preprocessing /tmp/moxygen/example/src/mountainbike.h...
Parsing file /tmp/moxygen/example/src/mountainbike.h...
Reading /tmp/moxygen/example/src/overview.md...
Preprocessing /tmp/moxygen/example/src/racingbike.cpp...
Parsing file /tmp/moxygen/example/src/racingbike.cpp...
Preprocessing /tmp/moxygen/example/src/racingbike.h...
Parsing file /tmp/moxygen/example/src/racingbike.h...
Preprocessing /tmp/moxygen/example/src/transport.h...
Parsing file /tmp/moxygen/example/src/transport.h...
Building macro definition list...
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Building concept list...
Computing nesting relations for classes...
Associating documentation with classes...
Associating documentation with concepts...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
Inheriting documentation...
Generating disk names...
Adding source references...
Adding xrefitems...
Sorting member lists...
Setting anonymous enum type...
Computing dependencies between directories...
Generating citations page...
Counting members...
Counting data structures...
Resolving user defined references...
Finding anchors and sections in the documentation...
Transferring function references...
Combining using relations...
Adding members to index pages...
Correcting members for VHDL...
Computing tooltip texts...
Generating style sheet...
Generating search indices...
Generating example documentation...
Generating file sources...
Generating code for file src/bicycle.h...
Generating code for file src/mountainbike.h...
Generating code for file src/racingbike.h...
Generating code for file src/transport.h...
Generating file documentation...
Generating page documentation...
Generating docs for page changelog...
Generating docs for page overview...
Generating group documentation...
Generating class documentation...
Generating concept documentation...
Generating namespace index...
Generating docs for compound transport::Bicycle...
Generating docs for compound transport::MountainBike...
Generating docs for compound transport::RacingBike...
Generating graph info page...
Generating directory documentation...
finalizing index lists...
writing tag file...
Generating XML output...
Generating XML output for class transport::Bicycle
Generating XML output for class transport::MountainBike
/tmp/moxygen/example/src/mountainbike.h:23: warning: Found unknown command '@stiffness'
/tmp/moxygen/example/src/mountainbike.h:35: warning: Found unknown command '@BreakType'
/tmp/moxygen/example/src/mountainbike.h:36: warning: Found unknown command '@breakType'
Generating XML output for class transport::RacingBike
Generating XML output for namespace transport
Generating XML output for file bicycle.cpp
Generating XML output for file bicycle.h
Generating XML output for file changelog.md
Generating XML output for file mountainbike.cpp
Generating XML output for file mountainbike.h
Generating XML output for file overview.md
Generating XML output for file racingbike.cpp
Generating XML output for file racingbike.h
Generating XML output for file transport.h
Generating XML output for group bicycle
Generating XML output for group racingbike
Generating XML output for group mountainbike
Generating XML output for page changelog
Generating XML output for page overview
Generate XML output for dir /tmp/moxygen/example/src/
Running plantuml with JAVA...
lookup cache used 39/65536 hits=60 misses=41
finished...
verbose: Parsing example/xml/index.xml
verbose: Parsing example/xml/classtransport_1_1Bicycle.xml
verbose: Processing compound transport::Bicycle
verbose: Processing member function PedalHarder
verbose: Processing member function RingBell
verbose: Processing member function ~Bicycle
verbose: Parsing example/xml/classtransport_1_1MountainBike.xml
verbose: Processing compound transport::MountainBike
verbose: Processing member function SetSuspension
verbose: Processing member function ChangeBreak
verbose: Parsing example/xml/classtransport_1_1RacingBike.xml
verbose: Processing compound transport::RacingBike
verbose: Processing member function PedalHarder
verbose: Processing member function RingBell
verbose: Parsing example/xml/namespacetransport.xml
verbose: Processing compound transport
verbose: Parsing example/xml/group__bicycle.xml
verbose: Processing compound bicycle
verbose: Parsing example/xml/group__racingbike.xml
verbose: Processing compound racingbike
verbose: Parsing example/xml/group__mountainbike.xml
verbose: Processing compound mountainbike
verbose: Parsing example/xml/changelog.xml
verbose: Processing compound changelog
false anchor: not yet supported.
false anchor: not yet supported.
verbose: Parsing example/xml/overview.xml
verbose: Processing compound overview
false anchor: not yet supported.
false anchor: not yet supported.
verbose: Parsing example/xml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml
verbose: Processing compound src
verbose: Rendering group bicycle
verbose: Rendering class transport::Bicycle
verbose: Writing: example/doc/api-bicycle.md
verbose: Rendering group racingbike
verbose: Rendering class transport::RacingBike
verbose: Writing: example/doc/api-racingbike.md
verbose: Rendering group mountainbike
verbose: Rendering class transport::MountainBike
verbose: Writing: example/doc/api-mountainbike.md
verbose: Rendering page changelog
verbose: Writing: example/doc/page-changelog.md
verbose: Rendering page overview
node:events:495
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'kind')
    at Object.compoundPath (/tmp/moxygen/src/helpers.js:99:18)
    at Object.<anonymous> (/tmp/moxygen/src/helpers.js:84:21)
    at String.replace (<anonymous>)
    at Object.resolveRefs (/tmp/moxygen/src/helpers.js:71:20)
    at Object.<anonymous> (/tmp/moxygen/src/helpers.js:112:19)
    at Array.map (<anonymous>)
    at Object.writeCompound (/tmp/moxygen/src/helpers.js:111:67)
    at /tmp/moxygen/index.js:150:19
    at Array.forEach (<anonymous>)
    at /tmp/moxygen/index.js:147:15
Emitted 'error' event on Parser instance at:
    at exports.Parser.Parser.parseString (/tmp/moxygen/node_modules/xml2js/lib/parser.js:341:16)
    at Parser.parseString (/tmp/moxygen/node_modules/xml2js/lib/parser.js:5:59)
    at Object.<anonymous> (/tmp/moxygen/src/parser.js:523:17)
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Node.js v18.20.2

Does not attribute innergroups to compounds (modules)

The following (extremely commonly used) doxygen pattern is ignored by moxygen

   /**
    * @defgroup helloapi
    * @brief Defines API for saying hello
    *
    */

   /**
    * @defgroup hellocapi Hello C API
    * @ingroup helloapi
    * @brief Defines C API for saying hello
    */
   
    /**
    * @defgroup hellocppapi Hello CPP API
    * @ingroup helloapi
    * @brief Defines CPP API for saying hello
    */

This will result in the following markdown output for helloapi group

# group `helloapi` {#group__helloapi}

Defines API for saying hello

## Summary

 Members                        | Descriptions                                
--------------------------------|---------------------------------------------

For compliant operation in this scenaio, moxygen should be including hellocapi and hellocppapi as Modules of helloapi. In this test, Doxyfile is configured for this operation, and the HTML output displays properly, as does the structure of the XML.

AssertionError [ERR_ASSERTION]: false == true

Using Moxygen 0.8 I get a bunch of winston errors about having no transports and a false == true exception. If I roll back to 0.7.12 then everything works without error using same test project and same commandline.

[2/5] [MOXYGEN] Generating Documentation
FAILED: markdown/api.md 
cd /home/nephatrine/Code/kakihara/build-vscode/markdown && /usr/local/bin/moxygen --anchors --output api.md /home/nephatrine/Code/kakihara/build-vscode/xml
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/index.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/namespacekakihara.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound kakihara","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/namespacekakihara_1_1math.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound kakihara::math","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/md__l_i_c_e_n_s_e.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound md_LICENSE","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/dir_d44c64559bbebec7f509842c48db8b23.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound include","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/dir_ceefa81d554df2b91789412b9c8c4539.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound include/kakihara","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/dir_b19efdc78bc6575bc11ffa57743acbba.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound include/kakihara/math","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Parsing /home/nephatrine/Code/kakihara/build-vscode/xml/indexpage.xml","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Preprocessing compound index","level":"verbose"}
[winston] Attempt to write logs with no transports {"message":"Processing compound kakihara","level":"verbose"}
events.js:183
      throw er; // Unhandled 'error' event
      ^

AssertionError [ERR_ASSERTION]: false == true
    at Console.assert (console.js:194:23)
    at toMarkdown (/usr/local/lib/node_modules/moxygen/src/parser.js:135:15)
    at copy (/usr/local/lib/node_modules/moxygen/src/parser.js:146:25)
    at Object.parseCompound (/usr/local/lib/node_modules/moxygen/src/parser.js:323:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:445:16)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:443:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:474:9)
    at Parser.<anonymous> (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:303:18)
    at emitOne (events.js:116:13)
ninja: build stopped: subcommand failed.

Running on Ubuntu 18.10, Doxygen 1.8.13, and NPM 5.8.0. NPM package versions installed:

/usr/local/lib
├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   └── [email protected] deduped
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected] deduped
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├─┬ [email protected]
│ │ │ │ │ │ └── [email protected]
│ │ │ │ │ └─┬ [email protected]
│ │ │ │ │   ├── [email protected] deduped
│ │ │ │ │   └─┬ [email protected]
│ │ │ │ │     └── [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └─┬ [email protected]
│ │ │   └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected] deduped
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   ├─┬ [email protected]
│ │   │ ├── [email protected]
│ │   │ ├── [email protected] deduped
│ │   │ ├── [email protected]
│ │   │ ├── [email protected]
│ │   │ ├── [email protected] deduped
│ │   │ ├─┬ [email protected]
│ │   │ │ └── [email protected] deduped
│ │   │ └── [email protected] deduped
│ │   └── [email protected] deduped
│ └─┬ [email protected]
│   ├── [email protected]
│   └── [email protected]

Let me know what other information might be helpful.

OOM issues

unfortunately my last pr #33 broke quite a few things:

  • --classes no more generate all the classes
  • memory usage is very high as it is keeping all the parsed xml structures in memory

i looked around and identified the bug with the first issue (it is about having compounds with same name but different kind), but i'm not sure how to progress on the second one. i have xmls around ~250MB (around 2500 files) and i tested just keeping all the xml structure in memory leads to 3GB memory usage (only xml2js), so holding everything in memory probably wont work.

for context: when generating with --groups the ref links needs to "know" where to point to (e.g. if and which external markdown file will include the referenced compound). the problem with that, is the group "hierarchy" is established while parsing the compound xml, e.g. class A may reference class B (or a function inside) while class B is not yet parsed (and thus the group it belongs to not known yet - edit: well to be precise the group hierarchy information is coming from the group xml, not the class xml). (note --classes does not have the same problem, as all the needed information is already parsed from index)

i can think of two alternatives currently:

  • parsing the files in 2 turns, first only parse index and the needed information to build group hierarchy, then process all the compounds again and create the markdown representation. the downside of this is that though the 2 turns is only needed when using --groups, that is not really a parser concern
  • reverting the parsing and markdown generation to before my pr and placing some marker inside the generated markdown content for anchors, so only anchors can be replaced in a second run. the downside of this is it feels kind of duct taping

do you have any preference, or other ideas?

crashes (uncaught exception)

Just trying Moxygen for the first time. It crashes like this:

k2:doc tim$ moxygen --anchors --modules --output api-%s.md xml
verbose: Parsing xml/index.xml
verbose: Parsing xml/structc74_1_1min_1_1anything.xml
verbose: Processing compound c74::min::anything
verbose: Parsing xml/classc74_1_1min_1_1argument.xml
verbose: Processing compound c74::min::argument
verbose: Processing member argument
verbose: Processing member argument
verbose: Processing member type
verbose: Parsing xml/classc74_1_1min_1_1argument__base.xml
verbose: Processing compound c74::min::argument_base
verbose: Processing member m_owner
verbose: Processing member m_name
verbose: Processing member m_description
verbose: Processing member m_required
verbose: Processing member m_function
verbose: Processing member argument_base
verbose: Processing member operator()
verbose: Processing member description_string
verbose: Processing member name
verbose: Processing member required
verbose: Processing member type
verbose: Parsing xml/structdetails_1_1_arg_wrapper.xml
verbose: Processing compound details::ArgWrapper
verbose: Processing member arg1
verbose: Processing member arg2
verbose: Processing member arg3
verbose: Processing member ArgWrapper
verbose: Processing member callCallback
verbose: Parsing xml/structdetails_1_1_arg_wrapper_3_01_t_arg1_00_01_t_arg2_00_01void_01_4.xml
verbose: Processing compound details::ArgWrapper< TArg1, TArg2, void >
verbose: Processing member arg1
verbose: Processing member arg2
verbose: Processing member ArgWrapper
verbose: Processing member callCallback
verbose: Parsing xml/structdetails_1_1_arg_wrapper_3_01_t_arg1_00_01void_00_01void_01_4.xml
verbose: Processing compound details::ArgWrapper< TArg1, void, void >
verbose: Processing member arg1
verbose: Processing member ArgWrapper
verbose: Processing member callCallback
verbose: Parsing xml/structdetails_1_1_arg_wrapper_3_01void_00_01void_00_01void_01_4.xml
verbose: Processing compound details::ArgWrapper< void, void, void >
verbose: Processing member callCallback
verbose: Parsing xml/classc74_1_1min_1_1atom.xml
verbose: Processing compound c74::min::atom
verbose: Processing member atom

events.js:160
      throw er; // Unhandled 'error' event
      ^
AssertionError: ndash: not yet supported.
    at Console.assert (console.js:95:23)
    at toMarkdown (/usr/local/lib/node_modules/moxygen/src/parser.js:82:21)
    at /usr/local/lib/node_modules/moxygen/src/parser.js:29:16
    at Array.forEach (native)
    at toMarkdown (/usr/local/lib/node_modules/moxygen/src/parser.js:28:17)
    at toMarkdown (/usr/local/lib/node_modules/moxygen/src/parser.js:87:16)
    at /usr/local/lib/node_modules/moxygen/src/parser.js:29:16
    at Array.forEach (native)
    at toMarkdown (/usr/local/lib/node_modules/moxygen/src/parser.js:28:17)
    at toMarkdown (/usr/local/lib/node_modules/moxygen/src/parser.js:87:16)

Versions installed are

k2:doc tim$ node --version
v6.9.2
k2:doc tim$ npm --version
3.10.9
k2:doc tim$ moxygen --version
0.6.2

TypeError: Cannot read property 'forEach' of undefined

Running moxygen on a Doxygen generated xml directory I'm running into:

verbose: Parsing xml/index.xml
events.js:141
      throw er; // Unhandled 'error' event
      ^
TypeError: Cannot read property 'forEach' of undefined
    at Object.module.exports.parseIndex (/usr/local/lib/node_modules/moxygen/src/parser.js:416:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/parser.js:455:14)
    at Parser.<anonymous> (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:303:18)
    at emitOne (events.js:77:13)
    at Parser.emit (events.js:169:7)
    at Object.onclosetag (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/parser.js:261:26)
    at emit (/usr/local/lib/node_modules/moxygen/node_modules/sax/lib/sax.js:624:35)
    at emitNode (/usr/local/lib/node_modules/moxygen/node_modules/sax/lib/sax.js:629:5)
    at closeTag (/usr/local/lib/node_modules/moxygen/node_modules/sax/lib/sax.js:889:7)
    at Object.write (/usr/local/lib/node_modules/moxygen/node_modules/sax/lib/sax.js:1436:13)

That reminds a lot of #3, so I have manually merged 2c067f5 into my installation. This issue seems to be at a different place (line 416), though.:

    412     return;
    413   },
    414 
    415   parseIndex: function (root, index, options) {
    416     index.forEach(function (element) {
    417       var doxygen, compound = root.find(element.name[0], true);
    418       var xmlParser = new xml2js.Parser({
    419         explicitChildren: true,
    420         preserveChildrenOrder: true,
    421         charsAsChildren: true
    422       });

Customize label names

It would be great if label names could be customized. For example using using or alias instead of typedef.

More than one level one header breaks MkDocs toc

MkDocs translates level one Markdown headers '#' into html <h1>. Because there is only one h1 allowed in html, the TOC in MkDocs breaks if there is a second # header in the Markdown file.

In the files moxygen generates for my project, I never see level three headers. So Group could be level one, Class could be level two and Members and Summary could be level three. But that's only my project.

Support for member groups

Moxygen should support Doxygen member groups (special command \name) in its "Summary" section. It greatly improves the structure and readibility of the documentation.

Winston: Unexpected Token - dependency update?

Hi,
I'm getting this error from winston, which should have been fixed in winston at least.

/usr/local/lib/node_modules/moxygen/node_modules/winston/lib/winston.js:11
const { warn } = require('./winston/common');
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/bin/moxygen.js:4:11)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Are you using an older version of winston? Or can this issue be my side?
Thanks for your help

Javascript Heap out of memory

Hey guys! So, I'm trying to read through a documentation from my project here, and it gave me an error, but I don't know what exactly happened. Can you help me?


<--- Last few GCs --->

[15680:000001E5D8FBC040]    13817 ms: Mark-sweep 1394.7 (1425.0) -> 1394.3 (1424.0) MB, 401.6 / 0.0 ms  (average mu = 0.085, current mu = 0.027) allocation failure scavenge might not succeed
[15680:000001E5D8FBC040]    13822 ms: Scavenge 1395.0 (1424.5) -> 1394.6 (1425.0) MB, 2.6 / 0.0 ms  (average mu = 0.085, current mu = 0.027) allocation failure

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 000001D36D2DC5C1]
Security context: 0x025a5611e6e1 <JSObject>
    1: onclosetag [000003DCF82BB4A9] [C:\Users\brunodg\AppData\Roaming\npm\node_modules\moxygen\node_modules\xml2js\lib\parser.js:~172] [pc=000001D36D78526D](this=0x03dcf8288711 <SAXParser map = 000002CFA9B779F9>)
    2: arguments adaptor frame: 1->0
    3: closeTag [000000B8B7E6E159] [C:\Users\brunodg\AppData\Roaming\npm\node_modules\moxygen\node_modules\...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6116B0EFA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810
 2: 00007FF61168A296 node::MakeCallback+4518
 3: 00007FF61168AC80 node_module_register+2160
 4: 00007FF6119209BE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF6119208EF v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF611E5E954 v8::internal::Heap::MaxHeapGrowingFactor+11476
 7: 00007FF611E550B7 v8::internal::ScavengeJob::operator=+25543
 8: 00007FF611E5362C v8::internal::ScavengeJob::operator=+18748
 9: 00007FF611E5C5A7 v8::internal::Heap::MaxHeapGrowingFactor+2343
10: 00007FF611E5C626 v8::internal::Heap::MaxHeapGrowingFactor+2470
11: 00007FF6119FF278 v8::internal::Factory::AllocateRawArray+56
12: 00007FF6119FFBF2 v8::internal::Factory::NewFixedArrayWithFiller+66
13: 00007FF611C446E3 v8::internal::HashTable<v8::internal::SimpleNumberDictionary,v8::internal::SimpleNumberDictionaryShape>::KeyAt+7651
14: 00007FF611C1B070 v8::internal::JSReceiver::class_name+7968
15: 00007FF611C1B8ED v8::internal::JSReceiver::class_name+10141
16: 00007FF611C21500 v8::internal::JSReceiver::class_name+33712
17: 00007FF611AF222D v8::internal::LookupIterator::Delete+237
18: 00007FF611C22B48 v8::internal::JSReceiver::class_name+39416
19: 00007FF6119F289D v8::internal::wasm::WasmCodeManager::LookupCode+31821
20: 00007FF6119F2BCE v8::internal::wasm::WasmCodeManager::LookupCode+32638
21: 000001D36D2DC5C1

Crash with: Maximum call stack size exceeded

Running with : moxygen --anchors --groups --output api-%s.md xml

This is the ouput it generates:

verbose: Parsing xml/dir_f2541a3b18981391fa76fac5599e978a.xml
verbose: Processing compound Modules
verbose: Parsing xml/dir_767e358558999a3484dff556e4638747.xml
verbose: Processing compound Modules/Bowl/src
events.js:141
      throw er; // Unhandled 'error' event
      ^

RangeError: Maximum call stack size exceeded
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/compound.js:34:51)
    at Array.map (native)
    at Object.Compound.toArray (/usr/local/lib/node_modules/moxygen/src/compound.js:34:39)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/compound.js:43:37)
    at Array.forEach (native)
    at Object.Compound.toArray (/usr/local/lib/node_modules/moxygen/src/compound.js:40:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/compound.js:43:37)
    at Array.forEach (native)
    at Object.Compound.toArray (/usr/local/lib/node_modules/moxygen/src/compound.js:40:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/moxygen/src/compound.js:43:37)

TypeError: Cannot read property 'namespace' of undefined

$sudo npm install moxygen -g
/usr/local/bin/moxygen -> /usr/local/lib/node_modules/moxygen/bin/moxygen.js
[email protected] /usr/local/lib/node_modules/moxygen
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

$moxygen -a -g -o api-%s.md xml
.............
verbose: Processing compound std
events.js:141
throw er; // Unhandled 'error' event
^

TypeError: Cannot read property 'namespace' of undefined
at Object.module.exports.assignToNamespace (/usr/local/lib/node_modules/moxygen/src/parser.js:219:31)
at Object. (/usr/local/lib/node_modules/moxygen/src/parser.js:324:22)
at Array.forEach (native)
at Object.module.exports.parseCompound (/usr/local/lib/node_modules/moxygen/src/parser.js:321:34)
at Object. (/usr/local/lib/node_modules/moxygen/src/parser.js:366:16)
at Parser. (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/xml2js.js:489:18)
at emitOne (events.js:77:13)
at Parser.emit (events.js:169:7)
at Object.onclosetag (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/lib/xml2js.js:447:26)
at emit (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/node_modules/sax/lib/sax.js:640:35)
at emitNode (/usr/local/lib/node_modules/moxygen/node_modules/xml2js/node_modules/sax/lib/sax.js:645:5)


Not quite sure what to do at this point

Code blocks are always cpp

I have some documented code blocks in doxygen that are not c++. But parser.js always uses ```cpp for the block.

The xml file has the info and it can be pulled using this code in parser.js

case 'programlisting': 
            var extension = 'cpp';
            if( element.$ !== undefined ){
              if( element.$.filename !== undefined ){
                extension = element.$.filename.substr(1);
              }
            }
            s = '\n```' + extension + '\n'; 
            break;

I can create a pull request if this is a worthwhile change.

Doesn't do anything, at all.

This command has no markdown output, not in the specified --output file or to STDOUT. I got all excited with the blog post and turns out this tool isn't ready to use. Yes, it's clearly parsing all the XML, but then it does no more.

Also, the binary is still called doxygen2md.

Static methods

Spent hours figuring out why my class won't get documented. It appears it's because my methods are static. Is it a bug?

Moxygen NPM package is not the same as this repo

Hi everyone, I struggled for a few hours now with the pr #46, because the src/utils.js file is not the same in the distributed npm package as in the master branch on github. Therefore the fix from #46 is not provided yet. I would appreciate it a lot, if the distribution could be updated, so that future CPP programmers don't run into the same error again...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.