Add Markdown documentation converted from XML sources - #87
Conversation
dspinellis
left a comment
There was a problem hiding this comment.
Thanks! The original XML files were converted into the online HTML documentation with a custom tool. As a minimum this change needs a process to create the HTML documentation (in chapters and in whole).
|
Added a mkdocs config (docs/mkdocs.yml) that builds the Markdown into HTML with chapter navigation and search. Uses the readthedocs theme. The full pipeline now: Produces 42 HTML pages with a sidebar, prev/next links between chapters, and a search bar. All 19 images are included. Build takes under a second. Only dependency is mkdocs (pip install mkdocs). The HTML output directory is gitignored. |
dspinellis
left a comment
There was a problem hiding this comment.
Thank you for the change! Please review carefully the generated HTML against the original one. I tested the conversion and the HTML generation and see the following issues. More may exist.
- The generation process emits tens of warnings like the ones below and hyperlinks are no longer working.
WARNING - Doc file 'README.md' contains a link '34-dbschema.md', but the target
is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '35-qeg.md', but the target is
not found among documentation files.
WARNING - Doc file 'README.md' contains a link '42-mancscc.md', but the target
is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '43-mancscout.md', but the
target is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '44-mancscut.md', but the target
is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '45-mancsmake.md', but the
target is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '46-mancsreconst.md', but the
target is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '47-mancssplit.md', but the
target is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '48-mancsmerge.md', but the
target is not found among documentation files.
WARNING - Doc file 'README.md' contains a link '49-mancswc.md', but the target
is not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
WARNING - Doc file '02-walk.md' contains a link 'simul.md', but the target is
not found among documentation files.
- Diagrams have gone missing (See , e.g.
21-cg) - Some tables are mis-formated, see e.g. the example below.
4. The manual pages are missing (Consider adjusting the process of creating them to generate directly Markdown, rather than going through HTML).
|
@dspinellis pushed fixes for the issues you pointed out: Fixed 581 broken simul.md links across 12 files. Those were pointing to the interactive web demo, which doesn't exist in static docs, so I replaced them with plain text. Also got the broken links in 04-flow.md and the short.md reference in the FAQ. Converted all 8 man pages from the troff sources in man/*.1 to markdown (files 42-49). They're in the mkdocs nav now under a Man Pages section. Added 34-dbschema.md and 35-qeg.md. Since the content for these is auto-generated from CScout's SQL dump, I wrote them based on what's described in the SQL Back-end chapter. Table formatting I haven't touched yet. The single-column tables are coming from how the XML converter handles the original HTML table elements. Fixing that properly means reworking the converter's table parsing. Want me to take that on, or is this OK for now? |
|
That was fast!
For
Both of these conversions should be done dynamically, to always keep the files in sync.
This needs fixing. You can manually tweak the Markdown files, as these will be maintained as the source of truth. (Your commit should remove the XML files). It would also be nice to have a single printable technical report with the complete documentation in a single page, as is currently the case. This could be Markdown or PDF, whatever is easier for you. |
Add doc/xml2md.py converter script and docs/markdown/ output directory
containing 41 chapters of CScout documentation converted from the
custom SGML-style XML format to GitHub-Flavored Markdown.
The converter handles all custom tags including <fmtcode> code blocks
with syntax highlighting, unclosed SGML tags (<p>, <li>), HTML entity
replacement, cross-reference link rewriting (.html -> .md), and GFM
table generation.
10 auto-generated XML files (man pages, dbschema, qeg) are skipped
since they are built from binaries/scripts at build time.
The converter can be re-run as XML sources are updated:
python3 doc/xml2md.py [--outdir docs/markdown]
Relates to cscout-project#8
Added docs/mkdocs.yml with readthedocs theme and chapter navigation. Updated xml2md.py to copy images into the markdown directory. Build output goes to doc/html/ (gitignored). Build steps: python3 doc/xml2md.py cd docs && mkdocs build Produces 42 HTML pages with sidebar navigation, search, and all images included. Tested end to end.
Address review feedback: 1. Fix 581 broken simul.md links across 12 files by replacing dead hyperlinks with plain text (these pointed to the interactive CScout web demo which doesn't exist in static docs) 2. Fix broken links in 04-flow.md (wsp.md, csmake.md, pragma.md) and 41-faq.md (short.md) to use numbered filenames 3. Convert all 8 man pages from troff (man/*.1) to markdown (files 42-49) and add them to mkdocs.yml nav 4. Add 34-dbschema.md and 35-qeg.md for the database schema and SQL query examples chapters Build now runs with zero warnings. Signed-off-by: saivedant169 <saivedant169@gmail.com>
- Point simul.md links to the existing simul.html (581 links) - Fix broken links in 04-flow.md and 41-faq.md - Convert man pages from troff dynamically via xml2md.py - Generate dbschema and qeg chapters dynamically via xml2md.py - Fix 25 mis-formatted single-column tables (converted to code blocks) - Add single printable page (docs/cscout-manual.md, 9370 lines) - Remove 42 XML source files (markdown is now source of truth) - Copy simul.html and image assets into docs/markdown - Build runs with zero warnings Signed-off-by: saivedant169 <saivedant169@gmail.com>
9a4de11 to
a92085e
Compare
|
@dspinellis rebased this on master. The only conflict was ext.xml, and since the XML is being removed I carried your recent C23 additions there (typeof, typeof_unqual, constexpr, nullptr) into 28-ext.md so they are not lost. mkdocs build now runs with zero warnings. Recap against your last review:
One honest caveat on dbschema and qeg: xml2md.py generates those chapters, but the content is curated text rather than parsed from a live schema, since the real SQL schema only exists after running cscout -s on a project. If you would prefer them generated from actual cscout -s output so they stay exactly in sync, I am happy to wire that in, just let me know which SQL dialect to use for the sample. Ready for another look when you have time. |
Relates to #8
What this does
Converts CScout's 51-chapter XML documentation to GitHub-Flavored Markdown, producing 41 Markdown files (8,065 lines) in
docs/markdown/. Also includes the converter script (doc/xml2md.py) so the conversion can be re-run as the XML sources evolve.Why a custom converter
The CScout docs use a custom SGML-style XML format (not DocBook or standard XML), with unclosed HTML tags like
<p>,<li>, and custom elements like<fmtcode ext="c">. Pandoc and standard XML parsers can't handle this directly. The converter uses Python'shtml.parserwhich handles unclosed SGML tags gracefully.What the converter handles
<fmtcode ext="c">```c)<em>,<strong>,<code>*italic*,**bold**,`code`<h2>,<h3>,<h4>##,###,####headings<ul>/<ol>/<li>(unclosed)<table>/<tr>/<td>/<th><dl>/<dt>/<dd><a href="...html">.html→.mdrewriting<pre>What's included
doc/xml2md.py— The converter script (338 lines, no external dependencies)docs/markdown/README.md— Generated table of contents with linksdocs/markdown/01-intro.mdthrough51-change.md— All 41 converted chaptersWhat's excluded
10 XML files are auto-generated at build time (man pages from
.1files,dbschema.xmlfrom CScout binary output,qeg.xmlfrom SQL scripts). These are skipped since they don't exist in the source tree and would need to be regenerated after a build.Usage