Code Documentation in Dart - dart

Do we have any code documentation syntax and tool support for generating Code Documentation out of Dart Application Code, something similar to Doxygen for C/C++. I prefer to use Markdown styled syntax than doxygen-syntax.

The DartDoc tool (which uses markdown) creates API documentation (as found at api.dartlang.org )
This describes the api reference for using DartDoc in your own code
The Readme.txt here, shows how you can format your code comments to generate API doc

///I am the beerclass
class BeerClass{
///this is a beer variable
String beername;
///this is a beer method
String get getBeer => "beer for the people";
}
Just go in the Darteditor: Tools->Generate Dartdoc. You get a new directory docs and you start index.html in your browser. Your class, variable and method have now documentation.

Related

Does dart doc support generation of markdown instead of HTML?

I have dart doc . working and generating HTML files.
I want to generate Markdown files instead.
When googling, I found this answer https://github.com/dart-lang/dartdoc/issues/1479#issuecomment-868961953 - which led me to this PR: https://github.com/dart-lang/dartdoc/pull/2703
In the diff https://github.com/dart-lang/dartdoc/pull/2703/files - I see format and md - but I'm new to this, so I don't know how to use this info to create the command I need to use.
I was expecting something like dart doc . --format md to work, but it doesn't.
Also, when I run dart doc --help, it leads me here: https://dart.dev/go/dartdoc-options-file - and it doesn't mention the ability to generate docs in Markdown.
Maybe this isn't supported? TY
dart doc can't create documentation in markdown format, you have to use the package dartdoc (see https://github.com/dart-lang/dartdoc/issues/3241#issuecomment-1302150336)
You have to run dart pub global run dartdoc --format=md (but the generated md may not be pure md, see https://github.com/dart-lang/dartdoc/issues/3237).

How to access standard string manipulation functions in Lua?

I need some basic string operations, like sub-string, find string in string etc. I found a documentation of some standard functions for that: http://www.lua.org/manual/2.4/node22.html
But when I try it, I get an error:
input:29: attempt to call a nil value (global 'strfind')
Do I have to use require? Or are those methods contained in some object?
The link you posted is for Lua version 2.4. The latest version as of this post is Lua version 5.3. Make sure you are viewing the documentation for the version of Lua that you are using.
Lua 5.3 Reference

How to parse comments / documentation in Groovy code?

I'd like to parse the JavaDocs / GroovyDocs in my Groovy source code and build a JSON file with the parts that I'm interested in. Is there a clean way of doing this? I'd like to retrieve the class docs, field docs, method docs, etc. Example:
/** Please parse me. */
class Foo { /** And me too */ def prop }
One of the responses in the following thread was helpful in mentinoing GroovyDocTool / GroovyLexer / GroovyRecognizer, but I could really use a concrete example of how to add my own custom parsing: How to parse groovy code?
My current workaround is to attempt parsing the HTML that the "groovydoc" and "grails doc" commands generate. I'll probably try using NekoHTML to convert the HTML into well-formed XML, then use XmlSlurper. See: http://www.codercorp.com/blog/groovy/reading-html-using-groovys-xmlslurper.html
You may try ANTLR and create a parser. But this will be a brand new parser you may have to write

ZF2 BBCode Parser

Hiho,
I use the ckeditor on my website for special textareas like forum
or signatures.
But I have a problem with the output. I use ZF2 and would like to
use ZendMarkup to render the output bbcode back in html.
But at every time I call
$bbcode->render(...)
I got the error
There is no Zend_Markup_Root markup.
The ZendMarkup is an extension inspired by the Zend_Markup from ZF1.
But I can't find any thing on API or other guides.
Does someone has any idea what as the problem is?
The ZendMarkup library is very old (last update is 10 months ago!) so I wouldn't use such library. If you would like, I think I traced the error down.
On this line there is a reference to Zend_Markup_Root while that should be ZendMarkup\Renderer\Markup\Html\Root. Try to change that line and see what happens.
Another way is to replace the ZendMarkup library with another library which does work and is updated regularly. An example is Decoda. If you load mjohnson/decoda in your composer.json, you can use Decoda in your Zend Framework 2 application:
<?php
use Decoda\Decoda;
$parser = new Decoda($bbcode);
$html = $parser->parse();
With tools like composer, there is no need to use solely Zend* components when there are better alternatives.

How to write javadoc links?

How do I write links into javadocs?
Currently, I have something like:
{#link java.lang.Math#sqrt(double) Math.sqrt}
to produce the text Math.sqrt that should link to the java.lang.Math.sqrt(double) API, however, all it does is produce the text, no link.
My answer is very much provided by Eddie, but his exact code doesn't work for me (or at least when using the version of javadoc that comes with Java 1.6)
If I do:
javadoc -linkoffline http://java.sun.com/javase/6/docs/api/
http://java.sun.com/javase/6/docs/api/package-list
-public FileName.java
then javadoc complains:
javadoc: warning - Error fetching URL:
http://java.sun.com/javase/6/docs/api/package-list/package-list
If, on the other hand, I do:
javadoc -linkoffline http://java.sun.com/javase/6/docs/api/
http://java.sun.com/javase/6/docs/api/
-public FileName.java
Then it works, and my links are populated as I want them to be.
Additionally, my link isn't malformed. The text {#link java.lang.Math#sqrt(double) Math.sqrt} produces the link text Math.sqrt instead of the default Math.sqrt(double).
To get a link to something external to your code, you need use the -linkoffline option
where the -linkoffline option has the format something like this (artificially wrapped):
-linkoffline http://java.sun.com/javase/6/docs/api/
http://java.sun.com/javase/6/docs/api/
This tells the JavaDoc tool where to find the link to the JavaDoc and for what packages to use that link. From the 2nd URL, it will append "package-list" to load the actual URL:
http://java.sun.com/javase/6/docs/api/package-list
which you can verify by loading it in a browser does contain the list of packages documented at that JavaDoc URL. This tells the JavaDoc tool that any #link references to anything in one of those packages should link to the provided URL.
I believe for what you're trying to do, you can do this:
#see java.lang.Math#sqrt(double)
It doesn't give you the alternate text, but it gives you the link.
You can also write a more generic link like using standard html:
Google
This document might be of assistance, remember that for #link you need to use the URL for the doc you are linking to.

Resources