|
| 1 | +# Markdown Style Guide |
| 2 | + |
| 3 | +This document defines the Markdown formatting standards for documentation in the Shopper iOS |
| 4 | +codebase. |
| 5 | + |
| 6 | + |
| 7 | +## General Formatting |
| 8 | + |
| 9 | +### Line Length |
| 10 | + |
| 11 | +Keep all lines under **100 characters**. Break long sentences and paragraphs at natural points |
| 12 | +to stay within this limit. |
| 13 | + |
| 14 | + ✅ Good: |
| 15 | + Faucibus consectetur lacinia nostra eros conubia nibh inceptos hendrerit, ante blandit |
| 16 | + vulputate imperdiet amet porttitor torquent mattis. |
| 17 | + |
| 18 | + ❌ Bad: |
| 19 | + Faucibus consectetur lacinia nostra eros conubia nibh inceptos hendrerit, ante blandit vulputate imperdiet amet porttitor torquent mattis. |
| 20 | + |
| 21 | + |
| 22 | +### Spacing |
| 23 | + |
| 24 | +Use consistent spacing for visual hierarchy: |
| 25 | + |
| 26 | +- **Between major sections**: 2 blank lines |
| 27 | +- **After code blocks**: 1 blank line |
| 28 | +- **Before subsections**: 1 blank line |
| 29 | +- **After section headers**: 1 blank line |
| 30 | + |
| 31 | +Example: |
| 32 | + |
| 33 | + ## Major Section |
| 34 | + |
| 35 | + Content here. |
| 36 | + |
| 37 | + |
| 38 | + ## Another Major Section |
| 39 | + |
| 40 | + ### Subsection |
| 41 | + |
| 42 | + Content after subsection header. |
| 43 | + |
| 44 | + code block here |
| 45 | + |
| 46 | + Content after code block. |
| 47 | + |
| 48 | + |
| 49 | +## Headers |
| 50 | + |
| 51 | +### Structure |
| 52 | + |
| 53 | +Use consistent header hierarchy: |
| 54 | + |
| 55 | + - `#` for document title |
| 56 | + - `##` for major sections |
| 57 | + - `###` for subsections |
| 58 | + - `####` for sub-subsections (use sparingly) |
| 59 | + |
| 60 | +### Numbering |
| 61 | + |
| 62 | +Number subsections when they represent sequential steps or ordered items: |
| 63 | + |
| 64 | + ## Usage Patterns |
| 65 | + |
| 66 | + ### 1. Basic Setup |
| 67 | + ### 2. Advanced Configuration |
| 68 | + ### 3. Verification |
| 69 | + |
| 70 | + |
| 71 | +## Code Blocks |
| 72 | + |
| 73 | +### Indented Code Blocks |
| 74 | + |
| 75 | +Use **4-space indentation** for all code blocks instead of fenced blocks: |
| 76 | + |
| 77 | + ✅ Good: |
| 78 | + import DevTesting |
| 79 | + |
| 80 | + final class MockService: ServiceProtocol { |
| 81 | + nonisolated(unsafe) var performActionStub: Stub<String, Bool>! |
| 82 | + } |
| 83 | + |
| 84 | + ❌ Bad: |
| 85 | + ```swift |
| 86 | + import DevTesting |
| 87 | + |
| 88 | + final class MockService: ServiceProtocol { |
| 89 | + nonisolated(unsafe) var performActionStub: Stub<String, Bool>! |
| 90 | + } |
| 91 | + ``` |
| 92 | + |
| 93 | + |
| 94 | +## Lists |
| 95 | + |
| 96 | +### Unordered Lists |
| 97 | + |
| 98 | +Use `-` as the bullet character for unordered lists. Place the hyphen 2 spaces from current |
| 99 | +indentation level, followed by a space, then your text. When a bullet point spans multiple lines, |
| 100 | +align continuation lines with the start of the text (not the hyphen). This ensures all text within a |
| 101 | +bullet aligns vertically and makes proper indentation on continuation lines a matter of pressing tab |
| 102 | +one or more times. |
| 103 | + |
| 104 | + - Turpis cubilia sit urna dis ultricies consequat massa hendrerit enim natoque. |
| 105 | + - Consectetur sapien posuere sit arcu finibus mattis dictumst dis, lectus ipsum in dictum |
| 106 | + lobortis bibendum enim, suscipit aliquet nulla porta erat id class purus. |
| 107 | + - Scelerisque massa rutrum dapibus placerat aenean tellus arcu cursus. |
| 108 | + - Iaculis, cubilia tristique efficitur bibendum urna imperdiet facilisis turpis hac, |
| 109 | + platea est habitant auctor quisque nec pulvinar fermentum sociosqu. |
| 110 | + - Parturient justo, venenatis nunc lobortis senectus tortor orci elementum consequat. |
| 111 | + - In nibh nisl venenatis bibendum neque mattis habitant tempor proin, tincidunt lobortis |
| 112 | + vulputate commodo. |
| 113 | + |
| 114 | +Blank lines can be placed between bullets if it aids in readability. |
| 115 | + |
| 116 | +### Ordered Lists |
| 117 | + |
| 118 | +Use standard numbered lists for sequential items. Follow similar indentation rules as for unordered |
| 119 | +lists. Note that the `.` characters in the bullets leads to some strange indentation, but this is |
| 120 | +unavoidable. |
| 121 | + |
| 122 | + 1. Turpis cubilia sit urna dis ultricies consequat massa hendrerit enim natoque. |
| 123 | + |
| 124 | + 2. Consectetur sapien posuere sit arcu finibus mattis dictumst dis, lectus ipsum in dictum |
| 125 | + lobortis bibendum enim, suscipit aliquet nulla porta erat id class purus. |
| 126 | + |
| 127 | + 1. Scelerisque massa rutrum dapibus placerat aenean tellus arcu cursus. |
| 128 | + 2. Iaculis, cubilia tristique efficitur bibendum urna imperdiet facilisis turpis hac, |
| 129 | + platea est habitant auctor quisque nec pulvinar fermentum sociosqu. |
| 130 | + 3. Parturient justo, venenatis nunc lobortis senectus tortor orci elementum consequat. |
| 131 | + |
| 132 | + 4. In nibh nisl venenatis bibendum neque mattis habitant tempor proin, tincidunt lobortis |
| 133 | + vulputate commodo. |
| 134 | + |
| 135 | + |
| 136 | +## Text Formatting |
| 137 | + |
| 138 | +### Bold Text |
| 139 | + |
| 140 | +Use bold for emphasis on key terms: |
| 141 | + |
| 142 | + - **File names**: `Mock[ProtocolName].swift` |
| 143 | + - **Type names**: `Mock[ProtocolName]` |
| 144 | + |
| 145 | +### Code Spans |
| 146 | + |
| 147 | +Use backticks for: |
| 148 | + |
| 149 | + - Type names: `Stub<Input, Output>` |
| 150 | + - Function names: `performAction(_:)` |
| 151 | + - File names: `MockAppServices.swift` |
| 152 | + - Keywords: `nonisolated(unsafe)` |
| 153 | + |
| 154 | +### Terminology Consistency |
| 155 | + |
| 156 | +Use consistent terminology throughout documents: |
| 157 | + |
| 158 | +- Prefer "function" over "method" when referring to Swift functions |
| 159 | +- Use "type" instead of "class" when referring generically to classes/structs/enums |
| 160 | +- Use "property" for stored and computed properties |
| 161 | + |
| 162 | + |
| 163 | +## File Structure Examples |
| 164 | + |
| 165 | +Use indented text blocks for file structure diagrams: |
| 166 | + |
| 167 | + Tests/ |
| 168 | + ├── Folder 1/ |
| 169 | + │ └── Folder 2/ |
| 170 | + │ ├── File1.swift |
| 171 | + │ └── File2.swift |
| 172 | + └── Folder 3/ |
| 173 | + └── Folder 4/ |
| 174 | + ├── File3.swift |
| 175 | + └── File4.swift |
| 176 | + |
| 177 | + |
| 178 | +## Links and References |
| 179 | + |
| 180 | +### Internal References |
| 181 | + |
| 182 | +Use relative paths for internal documentation: |
| 183 | + |
| 184 | + See [Test Mock Documentation](TestMocks.md) for details. |
| 185 | + |
| 186 | +### Code References |
| 187 | + |
| 188 | +Reference specific locations using this pattern: |
| 189 | + |
| 190 | + The main implementation is in `Stub.swift:42-68`. |
0 commit comments