I am currently starting to write a documentation for one of our projects. For reasons of simplicity we chose to use the Almost Plain Text (APT) Format, see more info here: http://maven.apache.org/doxia/references/apt-format.html
APT is great documentation format, since it uses a minimal syntax and hence it is very easy to create and make changes to the documentation without knowing a lot about APT.
However, I couldn't find a way to format code in a nice way. Is there a code tag or similar, which can be used to include some source code? I'm aware I could use FML, but this would be less desirable.
Thanks
For those who are still wondering how to make a code snipped in APT:
This is regular text
+---------------------
This is a code snippet
+---------------------
More regular text
Apache Maven Fluido Skin highlights syntax out of the box. Here you can find an example. Information about syntax highlighting in Fluido: "Source code sections are enhanced by Google Code Prettify, users can optionally enable line numbers rendering (disabled by default)" from Fluido website.
The
+---------------------
code
+---------------------
syntax is correct. And Fluido does highlight using Prettify out of the box as others have mentioned.
However, a Doxia change in Site Plugin 3.3 broke Fluido. MSKINS-86 fixes this, but hasn't been released yet.
Workarounds
<body>
<head>
<script type="text/javascript">
$(document).ready(function () {
$("div.source pre").addClass("prettyprint");
prettyPrint();
});
</script>
</head>
</body>
I ended up using the snippet macro from the Doxia Macros Guide: http://maven.apache.org/doxia/macros/index.html#Snippet_Macro
It puts the code from the snippet file in a verbatim box. However it does not provide a syntax highlightning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With