cerberusdoc to markdown

Rich

Well-Known Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Sep 9, 2017
Hi
As part of releasing external modules on Github, I usually add the cerberusdoc file created for the module as the README.md file. this required a bit of manual conversion. I have just written this batch script that will crudely convert cerberusdoc to markdown. Its not perfect as it doesnt convert all CX markdown, but it does the job for my purposes (some tidyup maybe required afterwards)
Code:
@echo off
set inf=%1
set outf=%2
echo.>%outf%
FOR /F "eol= tokens=1* delims= " %%i in (%inf%) do if "%%i"=="<pre>" (echo ^`^`^` %%j>>%outf%) else (if "%%i"=="</pre>" (echo ^`^`^` %%j>>%outf%) else (if "%%i"==">>" (echo ## %%j>>%outf%) else (if "%%i"==">>>" (echo ### %%j>>%outf%) else (echo.%%i %%j>>%outf%))))
See it here https://github.com/pantson/pantson-cerberusx-appodeal
Fell free to reuse and improve. Im hoping someone will say theres already a tool, as it will make my job even easier ;-)
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Thanks for the tool! :)

This hurdle between Cerberus und Github is something to get rid of in the long run.
For now I am writing the docs in cerberusdoc markdown. Is Github markdown feature complete compared to cerberus markdown or are things missing?
 

MikeHart

Administrator
Joined
Jun 19, 2017
Location
Germany
One thing that has to be taken care of is the syntax highlighing. That might not be compatible.

But I guess it is time to figure it out. This morning the thought of recreating the front page its corresponding pages on Github pages dominates my mind, so I might give this a try soon. Well, very soon. ;)
 
Last edited:

Holzchopf

Moderator
3rd Party Module Dev
Joined
Jul 31, 2017
Location
Bern, Switzerland
I think Cerberus specific syntax highlighting won't be possible. I couldn't find another language that uses ' for single-line comments, #Rem #End for block comments and X...end as block delimiters. Cerberus is too small to have it's own supported syntax highlighting. And code blocks without comments make no sense.

But! Why not give it a go? We could still use ```cerberus or ```cerberusx as code-block indicator and let makedocs take care of the syntax highlighting (as today). On Github's .md preview, codes just wouldn't have any syntax highlighting at all, which is still better than having no documentation. And maybe one day Cerberus will be a supported language.
 

Rich

Well-Known Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Sep 9, 2017
Thought it might need expanding futhur, so started a cxdoc converter in CX

Feel free to contribute
 

Rich

Well-Known Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Sep 9, 2017
added some more code so that it supports links, anchors and bold highlighting.
Still need to fix tables
 

Rich

Well-Known Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Sep 9, 2017
fixed tables. Thats that for now
 
Top Bottom