Skip to content

Markdown style guide #40

Closed
Closed
@ehuss

Description

@ehuss

I think it would be good to have some guidance on preferences for how the Markdown text is written. These are some suggestions, many of which are from the Reference.

  • Restrict sources to .md or .html. We should make intentional decisions to include other types of sources as a team.

  • Prevent #![feature] in examples (the spec should not be documenting unstable)

  • Reject CRLF

    • This might have complications based on Windows' users core.autocrlf setting.
  • Reject tab

  • File must end with a newline

  • Lines must not end in spaces

    • This is important because trailing spaces are significant in Markdown, but I think that is a flaw.
  • Avoid double blank lines

  • Do not use indented code blocks (3+ backticks code blocks instead)

  • Code blocks should have an explicit language

  • Use ATX-style headings (not Setext)

  • Use sentence case for headings

  • Line wrapping
    Word wrapping column? 80? 90? 100? No wrapping? No preference? Semantic linefeeds?
    If not semantic linefeeds, then what is the policy for PRs? Should they rewrap any content they touch?

    • ehuss's preference: Semantic linefeeds are extremely helpful for dealing with diffs. Essentially, just once sentence per line.
  • Link kinds

    • There are different ways to link to things, such as reference links, or inline links.
      ehuss's preference is to only use reference links.
      Inline links disrupt the flow of the source text, so it can be recommended to avoid them.
      Use reference link shortcuts if appropriate.

      How should the references be organized? Within the section they are first used? At the bottom of the file? Should they be sorted?

      • ehuss's preference: Either at the bottom of a section, or at the bottom of the file, it doesn't really matter. Keep it sorted (case-insensitive?), which can help if there is a long list.
  • Always use relative links, to .md

    • Using .md relative links allows it to work in GitHub's rendering.
    • For now, we will not be able to do relative links to std and other Rust docs. These are important for properly supporting offline viewing of the Rust documentation. Also, our link validation only works with relative links. We may want to investigate better tooling for that.
  • Use smart punctuation instead of Unicode characters.
    Use --- for em-dash instead of the unicode character.

  • List style

    • Bullet lists: prefer -, *, or +?
      • ehuss's preference: Author's choice.
    • Ordered lists: Prefer 1. or 1)
      • Prefer repeating 1 so you don't have to renumber things? Or prefer to use the numbers 1, 2, 3, ...?
      • ehuss's preference: Author's choice.
  • Defining abbreviations

    <abbr title="dynamically sized types">DSTs</abbr>

    These are very helpful to people who may not know all abbreviations.

    Also, I think we should avoid Rust-specific abbreviations if possible (like APIT).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-meta-formattingCategory: Meta discussions about how content should be formatted in raw markdown

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions