Skip to content

How to format around a codeblock #5035

Closed
@burblebee

Description

@burblebee

How should we format wording where a codeblock is used for an expression at the end of a sentence, e.g.:
Remarks: The expression inside explicit is equivalent to:
!(is_convertible_v<decltype(get<I>(FWD(u))), Types> && ...)

This isn't an effects clause, but let's keep the formatting similar (see "Writing Effects: in a function description" in https://github.com/cplusplus/draft/wiki/Specification-Style-Guidelines). That said, this would most closely fit the "Effects: Equivalent to expression." case, but appending a "." at the end of the codeblock might look a bit strange. So we could instead follow the multi-statement codeblock case which is introduced via "Effects: Equivalent to:", because we're not completing the sentence here. We could adopt whatever formatting is used most consistently elsewhere in the spec - what's that? I think we typically don't use a ":" when we can complete the sentence with more text after the codeblock, and use a ":" to introduce the codeblock otherwise.

We should come up with guidelines for how to format normative wording that contains a codeblock and add examples to https://github.com/cplusplus/draft/wiki/Specification-Style-Guidelines, something like:

Some wording that introduces a codeblock with no text afterwards:

expression_part1
expression_part2

Some wording that contains a codeblock

expression_part1
expression_part2

but has more text afterwards, so can be part of a complete a sentence.

We should also expand the guidelines for how to write \effects clauses to include these cases.

Originally posted by @burblebee in #5024 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions