Documentation with Pod6

RakuDoc v2 (the updated specification for Raku documentation) extends Pod6 with more features. Check the RakuDoc docs for current status.

#| A simple bank account.
#| Supports deposits and withdrawals.
class BankAccount {
    has $.balance = 0;   #= Current balance

    #| Deposit a positive amount.
    method deposit($amount) { $!balance += $amount }
}

=begin pod

=head1 NAME

BankAccount - Simple account management

=head1 SYNOPSIS

=begin code :lang<raku>
my $acc = BankAccount.new;
$acc.deposit(100);
=end code

=head1 DESCRIPTION

B<BankAccount> provides I<basic> banking. See L<Raku docs|https://docs.raku.org>.
Inline code looks like C<deposit(100)>.

=item First point
=item Second point

=begin table
Method   | Description
=========|=============
deposit  | Add funds
balance  | Current balance
=end table

=end pod

say BankAccount.WHY;                  # declarator docs: "A simple bank account. Supports..."
say BankAccount.^find_method('deposit').WHY;
say $=pod[0].contents.elems;          # access Pod at run time
raku --doc script.raku                 # render Pod as text
raku --doc=Markdown lib/Module.rakumod # with Pod::To::Markdown installed
raku --doc=HTML lib/Module.rakumod     # with Pod::To::HTML installed