module my_module!< Module description. <-- after module statementinteger :: MY_CONST = 42 !< Constant description. <-- same line as declarationtype :: my_type !< Type description. <-- after type statement real :: x !< Component doc. <-- same line as component contains procedure :: init !< Bound procedure doc.endtypecontainssubroutine do_work(self, n)!< Subroutine description. <-- after subroutine statement!< Can span multiple lines.!< Supports **Markdown** and $\LaTeX$.class(my_type), intent(inout) :: self !< The object.integer, intent(in) :: n !< Iteration count.
Writing Fortran Doc Comments
Where to Place Comments
Doc Comment Rules
!<(not!!) whendocmark: <is set in the FORD project file!<on subsequent linesTips for Good Doc Comments
!< Conservative variables vectornot!< A real array!< CFL number (0 < cfl <= 1)or!< Temperature [K]LaTeX Math Support
Math rendering is enabled via
markdown: { math: true }inconfig.mts(usesmarkdown-it-mathjax3).In Hand-Written Markdown Pages
In Fortran Doc Comments
Both LaTeX delimiter styles work:
Or with
\(...\)and\[...\]notation:Fortran Syntax Highlighting
VitePress highlights Fortran code blocks. Use any of these language tags:
Tags
fortran,f90,f95,f03,f08all map to free-form Fortran. Usef77for fixed-form.