|
| 1 | +--- |
| 2 | +title: "Code Blocks Test" |
| 3 | +version: "1.0.0" |
| 4 | +created: "2026-01-01" |
| 5 | +last-updated: "2026-03-24" |
| 6 | +status: "current" |
| 7 | +tags: ["test", "code-blocks", "escape-chars"] |
| 8 | +--- |
| 9 | + |
| 10 | +# Code Blocks Test |
| 11 | + |
| 12 | +This document exercises escape-character and code-block edge cases that |
| 13 | +the validation scripts must handle without false positives. |
| 14 | + |
| 15 | +## Fenced Code Blocks — No False Links |
| 16 | + |
| 17 | +The VB.NET snippet below calls `_random.[Next](0, count)`, which looks like a |
| 18 | +markdown link `](0, count)` if the code fence is not properly detected. |
| 19 | + |
| 20 | +```vbnet |
| 21 | +Private Function GenerateIndex() As Integer |
| 22 | + Dim index As Integer = _random.[Next](0, _eventNames.Count) |
| 23 | + Return _messages(_random.[Next](0, _messages.Count)) |
| 24 | +End Function |
| 25 | +``` |
| 26 | + |
| 27 | +A C# snippet with square-bracket indexers: |
| 28 | + |
| 29 | +```csharp |
| 30 | +var result = myList[index].ToString(); |
| 31 | +var nested = dict["key"][0]; |
| 32 | +int[] arr = new int[items.Count]; |
| 33 | +``` |
| 34 | + |
| 35 | +The paths below are inside a fenced block and must **not** be extracted as |
| 36 | +file references (they are hypothetical examples, not real paths): |
| 37 | + |
| 38 | +```text |
| 39 | +src/Does/Not/Exist.cs |
| 40 | +docs/imaginary/file.md |
| 41 | +tests/NonExistent/Test.cs |
| 42 | +``` |
| 43 | + |
| 44 | +## Inline Code — Safe Backtick Paths |
| 45 | + |
| 46 | +These inline code paths **should** be extracted because they appear in prose: |
| 47 | + |
| 48 | +- `src/S7Tools/Services/Profiles/StandardProfileManager.cs` |
| 49 | + |
| 50 | +## Escaped Markdown Characters |
| 51 | + |
| 52 | +The following use backslash escapes and must not trigger validators: |
| 53 | + |
| 54 | +\[this is not a link\](not-a-target.md) |
| 55 | +\`not inline code\` |
| 56 | + |
| 57 | +## Mixed Fences |
| 58 | + |
| 59 | +Opening fence with extra backticks should be matched correctly: |
| 60 | + |
| 61 | +````markdown |
| 62 | +This is a code block with four backticks. |
| 63 | +](docs/fake-link.md) |
| 64 | +src/Fake/File.cs |
| 65 | +```` |
| 66 | + |
| 67 | +## Tildes as Fences |
| 68 | + |
| 69 | +~~~python |
| 70 | +def method(self, arg): |
| 71 | + return self.items[index](0, len(self.items)) |
| 72 | +~~~ |
| 73 | + |
| 74 | +## Nested Code in Lists |
| 75 | + |
| 76 | +- Item with `src/S7Tools/Services/Tasking/ResourceCoordinator.cs` inline ref. |
| 77 | +- Item without any code. |
| 78 | + |
| 79 | +## Links Inside Code Spans |
| 80 | + |
| 81 | +The text `[not a link](not-a-file.md)` written inside backticks should NOT |
| 82 | +produce a broken-link error. |
0 commit comments