Changeset 14843 for docs/Perl6/Spec

Show
Ignore:
Timestamp:
11/25/06 01:43:22 (2 years ago)
Author:
audreyt
Message:

* S26: Documentation spec, 2006-11-22 edition, from Damian.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Spec/Documentation.pod

    r14098 r14843  
     1=begin pod 
     2 
    13=for comment 
    24    This file is deliberately specified in Perl 6 Pod format 
     
    68=head1 TITLE 
    79 
    8 [DRAFT] Synopsis 26 - Documentation 
    9  
    10  
    11 =head1 AUTHORS 
    12  
    13 Damian Conway <damian@conway.org> 
    14  
    15 Ingy dE<ouml>t Net <ingy@cpan.org> 
     10Synopsis 26 - Documentation 
     11 
     12 
     13=head1 AUTHOR 
     14 
     15Damian Conway <L<C<damian@conway.org>|mailto:damian@conway.org>> 
    1616 
    1717 
    1818=head1 VERSION 
    1919 
    20 =for table 
    21     Maintainer:     Damian Conway <damian@conway.org> 
     20=table 
     21    Maintainer:     Damian Conway 
    2222    Date:           9 Apr 2005 
    23     Last Modified:  7 Oct 2006 
     23    Last Modified:  22 Nov 2006 
    2424 
    2525 
     
    2727 
    2828Perldoc is an easy-to-use markup language with a simple, consistent 
    29 underlying document object model. Perldoc can be used for writing the 
    30 documentation for Perl 5 and Perl 6, and for Perl programs and modules, 
    31 as well as for other types of document composition. 
     29underlying document object model. Perldoc can be used for writing 
     30language documentation, for documenting programs and modules, as well as 
     31for other types of document composition. 
    3232 
    3333Perldoc allows for multiple syntactic I<dialects>, all of which map onto 
    3434the same set of standard document objects. The standard dialect is named 
    35 L<"Pod"|#The Pod Dialect>. 
     35"Pod". 
    3636 
    3737 
    3838=head1 The Pod Dialect 
    3939 
    40 I<Pod> is an evolution of Perl 5's Plain Ol' Documentation (POD) markup. 
    41 Compared to Perl 5 POD, Perldoc's Pod dialect is much more uniform, 
    42 somewhat more compact, and considerably more expressive. 
     40B<Pod> is an evolution of Perl 5's L<I<Plain Ol' Documentation>|doc:perlpod> 
     41(POD) markup. Compared to Perl 5 POD, Perldoc's Pod dialect is much more 
     42uniform, somewhat more compact, and considerably more expressive. The 
     43Pod dialect also differs in that it is a purely descriptive mark-up 
     44notation, with no presentational components. 
     45 
    4346 
    4447=head2 General syntactic structure 
    4548 
    46 Pod blocks are specified using I<directives>, which always start with an 
    47 C<=> in the first column. Every Pod block directive may be written in 
    48 any of three equivalent forms: I<delimited style>, I<paragraph style>, 
    49 or I<abbreviated style>. 
     49Pod documents are specified using D<directives>, which are used to 
     50declare configuration information and to delimit blocks of textual content. 
     51Every directive starts with an equals sign (C<=>) in the first column. 
     52 
     53The content of a document is specified within one or more D<blocks>. Every 
     54Pod block may be declared in any of three equivalent forms: 
     55L<I<delimited style>|#Delimited blocks>, L<I<paragraph style>|#Paragraph 
     56blocks>, or L<I<abbreviated style>|#Abbreviated blocks>. 
     57 
     58Anything in a document that is neither a Pod directive nor contained 
     59within a Pod block is treated as "ambient" material. Typically this 
     60would be the source code of the program that the Pod is documenting. Pod 
     61parsers still parse this text into the internal representation of the 
     62file (representing it as an C<Perldoc::Block::Ambient> block), but 
     63renderers will usually ignore such blocks. 
     64 
     65In Perl 5's POD format, once a POD directive is encountered, the parser 
     66considers everything that follows to be POD, until an explicit C<=cut> 
     67directive is encountered, at which point the parser flips between POD 
     68and ambient text. The Perl 6 Pod format is different. A Pod parser 
     69always reverts to "ambient" at the end of each Pod directive or block. 
     70To cause the parser to remain in Pod mode, you must enclose the desired 
     71Pod region in a C<pod> block: 
     72 
     73=begin code :allow<B> 
     74    B<=begin pod> 
     75 
     76    =head1 A heading 
     77 
     78    This is Pod too. Specifically, this is a simple C<para> block 
     79 
     80        $this = pod('also');  # Specifically, a code block 
     81 
     82    B<=end pod> 
     83=end code 
     84 
     85Alternatively you can indicate an entire file contains only Pod, by 
     86giving it a C<.pod> suffix. 
    5087 
    5188 
     
    5592which are followed by a valid identifierN<A valid identifier is a 
    5693sequence of alphanumerics and/or underscores, beginning with an 
    57 alphabetic or underscore>, which is the typename of the block. Typenames 
     94alphabetic or underscore>, which is the D<typename> of the block. Typenames 
    5895that are entirely lowercase (for example: C<=begin head1>) or entirely 
    5996uppercase (for example: C<=begin SYNOPSIS>) are reserved. 
     
    6299configuration information for the block. This information is used in 
    63100different ways by different types of blocks, and is specified using 
    64 Perl6ish C<:key{value}> or C<< key=>value >> pairs (which must, of 
     101Perl6ish C<:key<value>> or C<< key=>value >> pairs (which must, of 
    65102course, be constants since Perldoc is a specification language, not a 
    66103programming language). 
    67 See L<Synposis 2|http://dev.perl.org/perl6/doc/design/syn/S02.html#Literals> 
     104See L<Synopsis 2|http://dev.perl.org/perl6/doc/design/syn/S02.html#Literals> 
    68105for a summary of the Perl 6 pair notation. 
    69106 
    70107The configuration section may be extended over subsequent lines by 
    71108starting those lines with an C<=> in the first column followed by a 
    72 horizontal whitespace character. 
     109whitespace character. 
    73110 
    74111The lines following the opening delimiter and configuration are the data 
     
    85122For example: 
    86123 
    87      =begin table  :title<Table of Contents> 
     124     =begin table  :caption<Table of Contents> 
    88125         Constants           1 
    89126         Variables           10 
    90127         Subroutines         33 
    91128         Everything else     57 
    92      =end Table 
     129     =end table 
    93130 
    94131     =begin Name  :required 
     
    101138     =end Contact 
    102139 
    103 Note that no blank lines are required around the directives, and blank 
     140Note that no blank lines are required around the directives; blank 
    104141lines within the contents are always treated as part of the contents. 
    105  
    106 Note also that in the following specifications, a "blank line" is a line that 
    107 is either empty or that contains only whitespace characters. That is, a blank 
    108 line matches C</^\s*?$/>. Pod uses blank lines, rather than empty lines, as 
    109 delimiters (on the principle of least surprise). 
     142This is a universal feature of Pod. 
     143 
     144Note also that in the following specifications, a "blank line" is a line 
     145that is either empty or that contains only whitespace characters. That 
     146is, a blank line matches the Perl 6 pattern: C</^^ \h* $$/>. Pod uses 
     147blank lines, rather than empty lines, as delimiters on the principle of 
     148least surprise. 
    110149 
    111150 
     
    115154the next Pod directive or the first blank line (which is I<not> 
    116155considered to be part of the block's contents). The C<=for> marker is 
    117 followed by the name of the directive and optional 
    118 configuration information. The general syntax is: 
     156followed by the name of the block and optional configuration 
     157information. The general syntax is: 
    119158 
    120159=begin code :allow< R > 
     
    122161     =                R<OPTIONAL EXTRA CONFIG INFO> 
    123162     R<BLOCK DATA> 
    124  
    125163=end code 
    126164 
    127165For example: 
    128166 
    129      =for table  :title<Table of Contents> 
     167     =for table  :caption<Table of Contents> 
    130168         Constants           1 
    131169         Variables           10 
     
    137175     The applicant's full name 
    138176 
    139      =for Contact  :optional 
     177     =for Contact  :optional    
    140178     The applicant's contact details 
    141  
    142 Once again, blank lines are not required around the directive (this is a 
    143 universal feature of Pod). 
    144179 
    145180 
     
    170205     =Contact  The applicant's contact details 
    171206 
     207Note that abbreviated blocks cannot specify configuration information. If 
     208configuration is required, use a C<=for> or C<=begin>/C<=end> instead. 
     209 
    172210 
    173211=head3 Block equivalence 
    174212 
    175 The three equivalent block specifications (delimited, paragraph, and 
    176 abbreviated) are treated identically by the underlying documentation 
    177 model, so you can use whichever form is most convenient for a particular 
    178 documentation task. In the descriptions that follow, the abbreviated form 
    179 will generally be used, but should be read as standing for all three 
    180 forms equally. 
     213The three block specifications (delimited, paragraph, and abbreviated) 
     214are treated identically by the underlying documentation model, so you 
     215can use whichever form is most convenient for a particular 
     216documentation task. In the descriptions that follow, the abbreviated 
     217form will generally be used, but should be read as standing for all 
     218three forms equally. 
    181219 
    182220For example, although L<#Headings> shows only: 
    183221 
    184      =head1 TOP LEVEL HEADING 
     222     =head1 Top Level Heading 
    185223 
    186224this automatically implies that you could also write that block as: 
    187225 
    188226     =for head1 
    189      TOP LEVEL HEADING 
     227     Top Level Heading 
    190228 
    191229or: 
    192230 
    193231     =begin head1 
    194      TOP LEVEL HEADING 
     232     Top Level Heading 
    195233     =end head1 
    196234 
     
    201239applied uniformly to built-in block types. These include: 
    202240 
    203 =begin item  :term<C<:indented>> 
    204  
    205 This option specifies that the block is to be indented by a particular 
    206 amount. If the indentation amount includes a sign (i.e. C<+> or C<->) then 
    207 the indentation is relative to the indentation of the surrounding construct; 
    208 unsigned indentations are absolute offsets from the first column. 
    209  
    210 If a simple number is used (e.g. C<:indent(4)>) it indicates "columns" (for 
    211 fixed-width renderers) or "ems" for variable-width renderers. You can also 
    212 specify a unit after the number. For example: 
    213  
    214     =for para :indented<1 tab> 
    215  
    216     =for para :indented<1 em> 
    217  
    218     =for para :indented<1 col> 
    219  
    220     =for para :indented<1 lvl> 
    221  
    222     =for para :indented<4 sp> 
     241=begin item :term<C<:nested>> 
     242 
     243This option specifies that the block is to be nested within its current 
     244context. For example, nesting might be applied to block quotes, to textual 
     245examples, or to commentaries. In addition the L<C<=code>|#Code blocks>, 
     246L<C<=item>|#Lists>, L<C<=input>|#I/O blocks>, and L<C<=output>|#I/O blocks> 
     247blocks all have implicit nesting. 
     248 
     249Nesting of blocks is usually rendered by adding extra indentation to the 
     250block contents, but may also be indicated in others ways: 
     251by boxing the contents, by changing the font or size of the nested text, 
     252or even by folding the text (so long as a visible placeholder is provided). 
     253 
     254Occasionally it is desirable to nest content by more than one level: 
     255 
     256    =begin para :nested 
     257    =begin para   :nested 
     258    =begin para     :nested 
     259    "We're going deep, deep, I<deep> undercover!" 
     260    =end para 
     261    =end para 
     262    =end para 
     263 
     264This can be simplified by giving the C<:nested> option a positive integer 
     265value: 
     266 
     267=for code :allow<B> 
     268    =begin para B<:nested(3)> 
     269    "We're going deep, deep, I<deep> undercover!" 
     270    =end para 
     271 
     272You can also give the option a value of zero, to defeat any implicit 
     273nesting that might normally be applied to a paragraph. For example, to 
     274specify a block of code that should appear I<without> its usual 
     275nesting: 
     276 
     277=for code :allow<B> 
     278    =comment Don't nest this code block in the usual way... 
     279    B<=begin code :nested(0)> 
     280 
     281                1          2         3         4         5         6 
     282        123456789012345678901234567890123456789012345678901234567890 
     283        |------|-----------------------|---------------------------| 
     284          line        instruction                comments 
     285         number           code 
     286 
     287    =end code 
     288 
     289Note that C<:!nested> could also be used for this purpose: 
     290 
     291    =begin code :!nested 
    223292 
    224293=end item 
     
    227296 
    228297This option specifies that the block is to be numbered. The most common 
    229 use of this option is to create L<numbered headings|#Numbered headings> and 
    230 L<ordered lists|#Ordered lists> but it can be applied to any block. 
     298use of this option is to create L<numbered headings|#Numbered headings> and  
     299L<ordered lists|#Ordered lists>, but it can be applied to any block. 
    231300 
    232301It is up to individual renderers to decide how to display any numbering 
     
    234303 
    235304=end item 
    236  
    237 =for item  :term<C<:bulleted>> 
    238 This option specifies that a list item has a bullet. See L<#Unordered lists>. 
    239305 
    240306=for item  :term<C<:term>> 
     
    249315For example, instead of: 
    250316 
    251     =comment The next para is important, so emphasize it... 
     317    =for comment 
     318        The next para is both important and fundamental, 
     319        so doubly emphasize it... 
     320 
    252321    =begin para 
    253322    B<I< 
    254323    Warning: Do not immerse in water. Do not expose to bright light. 
    255324    Do not feed after midnight. 
    256     >> 
     325 
    257326    =end para 
    258327 
    259328you can just write: 
    260329 
    261     =comment The next para is important, so emphasize it... 
    262     =begin para :formatted<B I> 
     330=for code :allow<B> 
     331    =begin para B<:formatted<B I>> 
    263332    Warning: Do not immerse in water. Do not expose to bright light. 
    264333    Do not feed after midnight. 
    265334    =end para 
    266335 
    267 Like all formatting codes, these are inherently cumulative. For example, 
    268 if the block itself is already inside a formatting code, that formatting 
    269 code will still apply, in addition to the extra bold and italic 
    270 formatting specified by C<:formatted<B I>>. It is also possible to 
    271 I<remove> formatting using a C<:formatted> option, by specifying the 
    272 formatting code(s) with a minus sign before them: 
    273  
    274     =comment The next para is less important, so de-emphasize it... 
    275     =begin para :formatted<-B> 
    276     Fire. The Untamed Element. Oldest of Man's Mysteries. Giver of 
    277     warmth. Destroyer of forests. Right now I<this> building is on fire. 
    278     Yes! The building is on fire! Leave the building! Enact the age-old 
    279     drama of self-preservation! 
    280     =end para 
    281  
     336The internal representations of these two versions are exactly the same, 
     337except that the second one retains the C<:formatted> option information 
     338as part of the resulting block object. 
     339 
     340Like all formatting codes, codes applied via a C<:formatted> are 
     341inherently cumulative. For example, if the block itself is already 
     342inside a formatting code, that formatting code will still apply, in 
     343addition to the extra "basis" and "important" formatting specified by 
     344C<:formatted<B I>>. 
    282345=end item 
    283346 
    284 =for item :term<C<:like<R<typename>>>> 
     347=begin item :term<C<:like>> 
    285348This option specifies that a block or config has the same formatting 
    286349properties as the type named by its value. This is useful for creating 
    287 related L<configurations|#Block pre-configuration>. 
     350related L<configurations|#Block pre-configuration>. For example: 
     351 
     352    =config head2  :like<head1> :formatting<I> 
     353 
     354=end item 
    288355 
    289356=for item  :term<C<:allow>> 
    290357This option expects a list of formatting codes that are to be recognized 
    291 within any C<V<>> codes nested inside the current block. The option is 
    292 most often used on C<=code> blocks to allow mark-up within those 
    293 (otherwise verbatim) blocks, though it can be used in I<any> block that 
    294 contains verbatim text. See L<#Formatting within code blocks>. 
    295  
     358within any C<V<>> codes that appear in (or are implicitly applied to) 
     359the current block. The option is most often used on C<=code> blocks to 
     360allow mark-up within those otherwise verbatim blocks, though it can be 
     361used in I<any> block that contains verbatim text. See L<#Formatting 
     362within code blocks>. 
    296363 
    297364 
     
    302369=head3 Headings 
    303370 
    304 Pod provides an unlimited number of levels of heading, specifed by the 
    305 T<=headR<N>> directive. For example: 
    306  
    307     =head1 A TOP LEVEL HEADING 
     371Pod provides an unlimited number of levels of heading, specified by the 
     372C<=head>R<N> block marker. For example: 
     373 
     374    =head1 A Top Level Heading 
    308375 
    309376    =head2 A Second Level Heading 
     
    314381 
    315382While Pod parsers are required to recognize and distinguish all levels 
    316 of heading, Pod formatters are only required to provide distinct 
     383of heading, Pod renderers are only required to provide distinct 
    317384I<renderings> of the first four levels of heading (though they may, of 
    318385course, provide more than that). Headings at levels without distinct 
     
    320387rendered level. 
    321388 
     389 
    322390=head4 Numbered headings 
    323391 
    324 You can specify that a heading is numbered using the C<:numbered> option. The 
    325 value of this option should be a sequence of characters containing a C<#>. If 
    326 the value is omitted (i.e. C<:numbered>), then it defaults to C<'#.'>. 
    327  
    328 The C<#> is replaced by the ordinal number of the heading block (within 
    329 its particular heading level): 
     392You can specify that a heading is numbered using the C<:numbered> option. For 
     393example: 
    330394 
    331395    =for head1 :numbered 
     
    335399    The Solution 
    336400 
    337     =for head2 :numbered<#:> 
     401    =for head2 :numbered 
    338402    Analysis 
    339403 
    340     =for head3 :numbered<(#)> 
     404    =for head3  
    341405    Overview 
    342406 
    343     =for head3 :numbered<(#)> 
     407    =for head3 
    344408    Details 
    345409 
    346     =for head2 :numbered<#:> 
     410    =for head2 :numbered 
    347411    Design 
    348412 
     
    352416which would produce: 
    353417 
    354 =begin indent :formatted<B> 
     418=begin nested :formatted<B> 
    3554191. The Problem 
    356420 
    3574212. The Solution 
    358422 
    359 =begin indent 
    360 2.1: Analysis 
    361  
    362 =begin indent 
    363 (2.1.1) Overview 
    364  
    365 (2.1.2) Details 
    366 =end indent 
     423=begin nested 
     4242.1. Analysis 
     425 
     426=begin nested 
     427Overview 
     428 
     429Details 
     430=end nested 
    367431 
    3684322.2: Design 
    369 =end indent 
     433=end nested 
    370434 
    3714353: The Implementation 
    372 =end indent 
     436=end nested 
    373437 
    374438It is usually better to preset a numbering scheme for each heading 
    375439level, in a series of L<configuration blocks|#Block pre-configuration>: 
    376440 
    377     =config head1 :numbered 
    378     =config head2 :numbered<#:> 
    379     =config head3 :numbered<(#)> 
     441=for code :allow<B> 
     442    B<=config head1 :numbered 
     443    =config head2 :numbered 
     444    =config head3 :!numbered> 
    380445 
    381446    =head1 The Problem 
     
    394459    =head1 # The Solution 
    395460    =head2   # Analysis 
    396     =head3     # Overview 
    397     =head3     # Details 
     461    =head3       Overview 
     462    =head3       Details 
    398463    =head2   # Design 
    399464    =head1 # The Implementation 
     
    407472should produce something like: 
    408473 
    409 =para :indented 
     474=nested 
    410475B<2.3.8.6.1.9. The Rescue of the Kobayashi Maru> 
    411476 
     
    415480Ordinary paragraph blocks consist of text that is to be formatted into 
    416481a document at the currently level of nesting, with whitespace 
    417 squeezed, lines filled, and any special inline mark-up (see 
    418 L<#Formatting codes>) applied. 
    419  
    420 Ordinary paragraphs consist of one or more lines of text, each of which 
    421 starts with a non-whitespace character at column 1. The paragraph is 
    422 terminated by the first blank line or opening block directive. For example: 
    423  
    424      This is an ordinary paragraph. 
    425      Its text  will   be     squeezed     and 
    426      short lines filled. It is terminated by 
    427      the first blank line 
    428  
    429      This is another ordinary paragraph. 
    430      Its     text    will  also be squeezed and 
    431      short lines filled. It is terminated by 
    432      the trailing directive on the next line 
    433      =head2 This is a heading block, not associated with the previous para 
    434  
    435 Within a C<=begin pod>/C<=end pod> block, ordinary paragraphs do not 
    436 require an explicit marker or delimiters, but there I<is> an explicit 
    437 C<para> marker available: 
     482squeezed, lines filled, and any special L<inline mark-up|#Formatting codes> 
     483applied. 
     484 
     485Ordinary paragraphs consist of one or more consecutive lines of text, 
     486each of which starts with a non-whitespace character at column 1. The 
     487paragraph is terminated by the first blank line or opening block 
     488directive. For example: 
     489 
     490    =head1 This is a heading block 
     491 
     492    This is an ordinary paragraph. 
     493    Its text  will   be     squeezed     and 
     494    short lines filled. It is terminated by 
     495    the first blank line 
     496 
     497    This is another ordinary paragraph. 
     498    Its     text    will  also be squeezed and 
     499    short lines filled. It is terminated by 
     500    the trailing directive on the next line 
     501 
     502    =head2 This is another heading block 
     503 
     504Within a C<=pod>, C<=item>, or C<=nested> block, ordinary paragraphs do not 
     505require an explicit marker or delimiters, but there is also an explicit 
     506C<para> marker (which may be used anywhere): 
    438507 
    439508     =para 
     
    450519     =end para 
    451520 
    452 As the previous example implies, when any form of explicit C<para> 
    453 directive is used all whitespace at the start of each line is removed. 
    454 Hence the ordinary paragraph text no longer has to begin at column 1. 
     521As the previous example implies, when any form of explicit C<para> block 
     522is used, any whitespace at the start of each line is removed, so 
     523the paragraph text no longer has to begin at column 1. 
    455524 
    456525 
    457526=head3 Code blocks 
    458527 
    459 Code blocks are used to specify pre-formatted text, which should 
    460 be rendered without rejustification, without whitespace-squeezing, and without 
    461 recognizing any inline formatting codes. Typically these blocks are used 
    462 to show examples of code, data, or I/O, and are set using a fixed-width font. 
    463  
    464 A code block is specified as one or more lines of text, each of which 
    465 starts with a whitespace character. The block is terminated by a blank line. 
    466 For example: 
    467  
    468      This I<ordinary> paragraph introduces a following 
    469      B<code> block: 
     528Code blocks are used to specify pre-formatted text (typically source 
     529code), which should be rendered without rejustification, without 
     530whitespace-squeezing, and without recognizing any inline formatting 
     531codes. Code blocks also have an implicit L<nesting|#Nesting blocks> 
     532associated with them. Typically these blocks are used to show examples 
     533of code, mark-up, or other textual specifications, and are rendered 
     534using a fixed-width font. 
     535 
     536A code block may be implicitly specified as one or more lines of text, 
     537each of which starts with a whitespace character. The block is 
     538terminated by a blank line. For example: 
     539 
     540=begin code 
     541    This ordinary paragraph introduces a code block: 
    470542 
    471543        $this = 1 * code('block'); 
    472         $that.is_specified(:by<indenting>); 
    473  
    474 There is also an explicit C<code> directive, which allows the contents 
    475 of code blocks to start at the first column, to start with whitespace 
    476 characters that are preserved exactly, and to contain blank lines: 
    477  
     544        $which.is_specified(:by<indenting>); 
     545=end code 
     546 
     547Implicit code blocks may only be used within C<=pod>, C<=item>, 
     548C<=nested>, or C<=END> blocks. 
     549 
     550There is also an explicit C<=code> block (which can be specified within 
     551I<any> other block type, not just C<=pod>, C<=item>, etc.): 
     552 
     553=begin code :allow<B> 
    478554     The C<loud_update()> subroutine adds feedback: 
    479555 
    480      =begin code 
     556     B<=begin code> 
    481557 
    482558     sub loud_update ($who, $status) { 
     
    486562     } 
    487563 
    488      =end code 
    489  
    490 The only limitation on the contents of a C<code> block is that they cannot 
    491 begin with an C<=> in the first column. If this is required, the leading C<=> 
    492 must be made C<verbatim|#Verbatim text>: 
    493  
    494     =begin code :allow<V> 
    495  
    496     V<=> in the first column is always a Perldoc directive 
    497  
    498     =end code 
    499  
    500 Renderers would normally indent the contents of any C<code> block (whether 
    501 it was implicitly or explicitly specified), but this can be overridden using 
    502 the C<:indented> option: 
    503  
    504     =comment 
    505         Indent this code block to the same column 
    506         as the surrounding text 
    507  
    508     =begin code :indented(+0) 
     564     B<=end code> 
     565=end code 
     566 
     567As the previous example demonstrates, within an explicit C<=code> block 
     568the code can start at the first column. Furthermore, lines that start 
     569with whitespace characters have that whitespace preserved exactly (in 
     570addition to the implicit nesting of the code). Explicit C<=code> blocks may 
     571also contain empty lines. 
     572 
     573 
     574=head4 Formatting within code blocks 
     575 
     576Although C<=code> blocks automatically disregard all L<formatting 
     577codes|#Formatting codes>, occasionally you may still need to specify 
     578some formatting within a code block. For example, you may wish 
     579to emphasize a particular keyword in an example (using a C<B<>> code). Or 
     580you may want to indicate that part of the example is metasyntactic 
     581(using the C<R<>> code). Or you might need to insert a non-ASCII 
     582character (using the C<E<>> code). 
     583 
     584You can specify a list of formatting codes that should still be 
     585recognized within a code block using the C<:allow> option. The value of 
     586the C<:allow> option must be a list of the (single-letter) names of one 
     587or more formatting codes. Those codes will then remain active inside the 
     588code block. For example: 
     589 
     590    =begin code :allow< B R > 
    509591    sub demo { 
    510         say "Hello World"; 
     592        B<say> 'Hello R<name>'; 
    511593    }