Skip to content

Commit a4f0aaa

Browse files
committed
put snippet- prefix back
1 parent dfb154b commit a4f0aaa

21 files changed

+62
-62
lines changed

docs/api.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ https://nuget.org/packages/MarkdownSnippets/ [![NuGet Status](https://img.shield
1616
## Reading snippets from files
1717

1818
<!-- snippet: ReadingFilesSimple -->
19-
<a id='readingfilessimple'></a>
19+
<a id='snippet-readingfilessimple'></a>
2020
```cs
2121
var files = Directory.EnumerateFiles(@"C:\path", "*.cs", SearchOption.AllDirectories);
2222

2323
var snippets = FileSnippetExtractor.Read(files);
2424
```
25-
<sup><a href='/src/Tests/Snippets/Usage.cs#L9-L15' title='Snippet source file'>snippet source</a> | <a href='#readingfilessimple' title='Start of snippet'>anchor</a></sup>
25+
<sup><a href='/src/Tests/Snippets/Usage.cs#L9-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-readingfilessimple' title='Start of snippet'>anchor</a></sup>
2626
<!-- endSnippet -->
2727

2828

2929
## Reading snippets from a directory structure
3030

3131
<!-- snippet: ReadingDirectorySimple -->
32-
<a id='readingdirectorysimple'></a>
32+
<a id='snippet-readingdirectorysimple'></a>
3333
```cs
3434
// extract snippets from files
3535
var snippetExtractor = new DirectorySnippetExtractor(
@@ -38,14 +38,14 @@ var snippetExtractor = new DirectorySnippetExtractor(
3838
!dirPath.EndsWith("obj"));
3939
var snippets = snippetExtractor.ReadSnippets(@"C:\path");
4040
```
41-
<sup><a href='/src/Tests/Snippets/Usage.cs#L42-L51' title='Snippet source file'>snippet source</a> | <a href='#readingdirectorysimple' title='Start of snippet'>anchor</a></sup>
41+
<sup><a href='/src/Tests/Snippets/Usage.cs#L42-L51' title='Snippet source file'>snippet source</a> | <a href='#snippet-readingdirectorysimple' title='Start of snippet'>anchor</a></sup>
4242
<!-- endSnippet -->
4343

4444

4545
## Full Usage
4646

4747
<!-- snippet: markdownProcessingSimple -->
48-
<a id='markdownprocessingsimple'></a>
48+
<a id='snippet-markdownprocessingsimple'></a>
4949
```cs
5050
var directory = @"C:\path";
5151

@@ -79,7 +79,7 @@ var missingSnippets = result.MissingSnippets;
7979
// snippets that the markdown file used
8080
var usedSnippets = result.UsedSnippets;
8181
```
82-
<sup><a href='/src/Tests/Snippets/Usage.cs#L56-L90' title='Snippet source file'>snippet source</a> | <a href='#markdownprocessingsimple' title='Start of snippet'>anchor</a></sup>
82+
<sup><a href='/src/Tests/Snippets/Usage.cs#L56-L90' title='Snippet source file'>snippet source</a> | <a href='#snippet-markdownprocessingsimple' title='Start of snippet'>anchor</a></sup>
8383
<!-- endSnippet -->
8484

8585

docs/config-file.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,35 @@ Add a file named `mdsnippets.json` at the target directory with the following co
1515
## For [InPlaceOverwrite](https://github.com/SimonCropp/MarkdownSnippets#inplaceoverwrite)
1616

1717
<!-- snippet: InPlaceOverwrite.json -->
18-
<a id='InPlaceOverwrite.json'></a>
18+
<a id='snippet-InPlaceOverwrite.json'></a>
1919
```json
2020
{
2121
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
2222
"Convention": "InPlaceOverwrite"
2323
}
2424
```
25-
<sup><a href='/src/ConfigReader.Tests/InPlaceOverwrite.json#L1-L4' title='Snippet source file'>snippet source</a> | <a href='#InPlaceOverwrite.json' title='Start of snippet'>anchor</a></sup>
25+
<sup><a href='/src/ConfigReader.Tests/InPlaceOverwrite.json#L1-L4' title='Snippet source file'>snippet source</a> | <a href='#snippet-InPlaceOverwrite.json' title='Start of snippet'>anchor</a></sup>
2626
<!-- endSnippet -->
2727

2828

2929
## For [SourceTransform](https://github.com/SimonCropp/MarkdownSnippets#sourcetransform)
3030

3131
<!-- snippet: SourceTransform.json -->
32-
<a id='SourceTransform.json'></a>
32+
<a id='snippet-SourceTransform.json'></a>
3333
```json
3434
{
3535
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
3636
"Convention": "SourceTransform"
3737
}
3838
```
39-
<sup><a href='/src/ConfigReader.Tests/SourceTransform.json#L1-L4' title='Snippet source file'>snippet source</a> | <a href='#SourceTransform.json' title='Start of snippet'>anchor</a></sup>
39+
<sup><a href='/src/ConfigReader.Tests/SourceTransform.json#L1-L4' title='Snippet source file'>snippet source</a> | <a href='#snippet-SourceTransform.json' title='Start of snippet'>anchor</a></sup>
4040
<!-- endSnippet -->
4141

4242

4343
## All Settings
4444

4545
<!-- snippet: allConfig.json -->
46-
<a id='allConfig.json'></a>
46+
<a id='snippet-allConfig.json'></a>
4747
```json
4848
{
4949
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
@@ -64,7 +64,7 @@ Add a file named `mdsnippets.json` at the target directory with the following co
6464
"HashSnippetAnchors": true
6565
}
6666
```
67-
<sup><a href='/src/ConfigReader.Tests/allConfig.json#L1-L18' title='Snippet source file'>snippet source</a> | <a href='#allConfig.json' title='Start of snippet'>anchor</a></sup>
67+
<sup><a href='/src/ConfigReader.Tests/allConfig.json#L1-L18' title='Snippet source file'>snippet source</a> | <a href='#snippet-allConfig.json' title='Start of snippet'>anchor</a></sup>
6868
<!-- endSnippet -->
6969

7070

docs/github-action.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Markdown snippets can be run inside a [GitHub Action](https://help.github.com/en
1212
Add the following to `.github\workflows\on-push-do-doco.yml` in the target repository.
1313

1414
<!-- snippet: on-push-do-docs.yml -->
15-
<a id='on-push-do-docs.yml'></a>
15+
<a id='snippet-on-push-do-docs.yml'></a>
1616
```yml
1717
name: on-push-do-docs
1818
on:
@@ -37,7 +37,7 @@ jobs:
3737
git push "${remote}" ${branch} || echo "nothing to push"
3838
shell: bash
3939
```
40-
<sup><a href='/docs/on-push-do-docs.yml#L1-L22' title='Snippet source file'>snippet source</a> | <a href='#on-push-do-docs.yml' title='Start of snippet'>anchor</a></sup>
40+
<sup><a href='/docs/on-push-do-docs.yml#L1-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-on-push-do-docs.yml' title='Start of snippet'>anchor</a></sup>
4141
<!-- endSnippet -->
4242
4343
This action performs the following tasks:

docs/header.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ To change this file edit the source file and then run MarkdownSnippets.
1010
When a .md file is written, a header is include. The default header is:
1111

1212
<!-- snippet: HeaderWriterTests.DefaultHeader.verified.txt -->
13-
<a id='HeaderWriterTests.DefaultHeader.verified.txt'></a>
13+
<a id='snippet-HeaderWriterTests.DefaultHeader.verified.txt'></a>
1414
```txt
1515
GENERATED FILE - DO NOT EDIT
1616
This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets).
1717
Source File: {relativePath}
1818
To change this file edit the source file and then run MarkdownSnippets.
1919
```
20-
<sup><a href='/src/Tests/HeaderWriterTests.DefaultHeader.verified.txt#L1-L4' title='Snippet source file'>snippet source</a> | <a href='#HeaderWriterTests.DefaultHeader.verified.txt' title='Start of snippet'>anchor</a></sup>
20+
<sup><a href='/src/Tests/HeaderWriterTests.DefaultHeader.verified.txt#L1-L4' title='Snippet source file'>snippet source</a> | <a href='#snippet-HeaderWriterTests.DefaultHeader.verified.txt' title='Start of snippet'>anchor</a></sup>
2121
<!-- endSnippet -->
2222

2323

docs/max-width.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ The Max Width setting is used to control the maximum characters per line of a sn
3232
### Code Api
3333

3434
<!-- snippet: DirectoryMarkdownProcessorRunMaxWidth -->
35-
<a id='directorymarkdownprocessorrunmaxwidth'></a>
35+
<a id='snippet-directorymarkdownprocessorrunmaxwidth'></a>
3636
```cs
3737
var processor = new DirectoryMarkdownProcessor(
3838
"targetDirectory",
3939
maxWidth: 80);
4040
processor.Run();
4141
```
42-
<sup><a href='/src/Tests/Snippets/Usage.cs#L30-L37' title='Snippet source file'>snippet source</a> | <a href='#directorymarkdownprocessorrunmaxwidth' title='Start of snippet'>anchor</a></sup>
42+
<sup><a href='/src/Tests/Snippets/Usage.cs#L30-L37' title='Snippet source file'>snippet source</a> | <a href='#snippet-directorymarkdownprocessorrunmaxwidth' title='Start of snippet'>anchor</a></sup>
4343
<!-- endSnippet -->
4444

4545

docs/snippet-exclusion.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ When scanning for snippets the following are ignored:
2828
* All binary files as defined by https://github.com/sindresorhus/binary-extensions/:
2929

3030
<!-- snippet: ExcludedFileExtensions -->
31-
<a id='excludedfileextensions'></a>
31+
<a id='snippet-excludedfileextensions'></a>
3232
```cs
3333
"md",
3434
"user",
@@ -297,17 +297,17 @@ When scanning for snippets the following are ignored:
297297
"zip",
298298
"zipx"
299299
```
300-
<sup><a href='/src/MarkdownSnippets/Reading/Exclusions/SnippetFileExclusions.cs#L32-L301' title='Snippet source file'>snippet source</a> | <a href='#excludedfileextensions' title='Start of snippet'>anchor</a></sup>
300+
<sup><a href='/src/MarkdownSnippets/Reading/Exclusions/SnippetFileExclusions.cs#L32-L301' title='Snippet source file'>snippet source</a> | <a href='#snippet-excludedfileextensions' title='Start of snippet'>anchor</a></sup>
301301
<!-- endSnippet -->
302302

303303
* Files that cannot contain comments:
304304

305305
<!-- snippet: NoAcceptCommentsExtensions -->
306-
<a id='noacceptcommentsextensions'></a>
306+
<a id='snippet-noacceptcommentsextensions'></a>
307307
```cs
308308
"csv",
309309
"json",
310310
"geojson"
311311
```
312-
<sup><a href='/src/MarkdownSnippets/Reading/Exclusions/SnippetFileExclusions.cs#L23-L27' title='Snippet source file'>snippet source</a> | <a href='#noacceptcommentsextensions' title='Start of snippet'>anchor</a></sup>
312+
<sup><a href='/src/MarkdownSnippets/Reading/Exclusions/SnippetFileExclusions.cs#L23-L27' title='Snippet source file'>snippet source</a> | <a href='#snippet-noacceptcommentsextensions' title='Start of snippet'>anchor</a></sup>
313313
<!-- endSnippet -->

docs/toc.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If a line is `toc` it will be replaced with a table of contents
1212
So if a markdown document contains the following:
1313

1414
<!-- snippet: tocBefore.txt -->
15-
<a id='tocBefore.txt'></a>
15+
<a id='snippet-tocBefore.txt'></a>
1616
```txt
1717
# Title
1818
@@ -26,13 +26,13 @@ Text1
2626
2727
Text2
2828
```
29-
<sup><a href='/docs/mdsource/toc/tocBefore.txt#L1-L11' title='Snippet source file'>snippet source</a> | <a href='#tocBefore.txt' title='Start of snippet'>anchor</a></sup>
29+
<sup><a href='/docs/mdsource/toc/tocBefore.txt#L1-L11' title='Snippet source file'>snippet source</a> | <a href='#snippet-tocBefore.txt' title='Start of snippet'>anchor</a></sup>
3030
<!-- endSnippet -->
3131

3232
The result will be rendered:
3333

3434
<!-- snippet: tocAfter.txt -->
35-
<a id='tocAfter.txt'></a>
35+
<a id='snippet-tocAfter.txt'></a>
3636
```txt
3737
# Title
3838
@@ -51,7 +51,7 @@ Text1
5151
5252
Text2
5353
```
54-
<sup><a href='/docs/mdsource/toc/tocAfter.txt#L1-L16' title='Snippet source file'>snippet source</a> | <a href='#tocAfter.txt' title='Start of snippet'>anchor</a></sup>
54+
<sup><a href='/docs/mdsource/toc/tocAfter.txt#L1-L16' title='Snippet source file'>snippet source</a> | <a href='#snippet-tocAfter.txt' title='Start of snippet'>anchor</a></sup>
5555
<!-- endSnippet -->
5656

5757

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Files are downloaded to `%temp%MarkdownSnippets` with a maximum of 100 files kep
230230
Defines the format of `snippet source` links that appear under each snippet.
231231

232232
<!-- snippet: LinkFormat.cs -->
233-
<a id='LinkFormat.cs'></a>
233+
<a id='snippet-LinkFormat.cs'></a>
234234
```cs
235235
namespace MarkdownSnippets
236236
{
@@ -243,11 +243,11 @@ namespace MarkdownSnippets
243243
}
244244
}
245245
```
246-
<sup><a href='/src/MarkdownSnippets/Processing/LinkFormat.cs#L1-L10' title='Snippet source file'>snippet source</a> | <a href='#LinkFormat.cs' title='Start of snippet'>anchor</a></sup>
246+
<sup><a href='/src/MarkdownSnippets/Processing/LinkFormat.cs#L1-L10' title='Snippet source file'>snippet source</a> | <a href='#snippet-LinkFormat.cs' title='Start of snippet'>anchor</a></sup>
247247
<!-- endSnippet -->
248248

249249
<!-- snippet: BuildLink -->
250-
<a id='buildlink'></a>
250+
<a id='snippet-buildlink'></a>
251251
```cs
252252
if (linkFormat == LinkFormat.GitHub)
253253
{
@@ -269,7 +269,7 @@ if (linkFormat == LinkFormat.GitLab)
269269
return $"{path}#L{snippet.StartLine}-{snippet.EndLine}";
270270
}
271271
```
272-
<sup><a href='/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs#L133-L153' title='Snippet source file'>snippet source</a> | <a href='#buildlink' title='Start of snippet'>anchor</a></sup>
272+
<sup><a href='/src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs#L133-L153' title='Snippet source file'>snippet source</a> | <a href='#snippet-buildlink' title='Start of snippet'>anchor</a></sup>
273273
<!-- endSnippet -->
274274

275275

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591</NoWarn>
5-
<Version>21.5.0</Version>
5+
<Version>21.6.0</Version>
66
<AssemblyVersion>1.0.0</AssemblyVersion>
77
<PackageTags>Markdown, Snippets, mdsnippets, documentation, MarkdownSnippets</PackageTags>
88
<Description>Extracts snippets from code files and merges them into markdown documents.</Description>

src/MarkdownSnippets/Processing/SnippetMarkdownHandling.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public SnippetMarkdownHandling(string rootDirectory, LinkFormat linkFormat, bool
3232
}
3333
else
3434
{
35-
getAnchorId = snippet => snippet.Key;
35+
getAnchorId = snippet => $"snippet-{snippet.Key}";
3636
}
3737
}
3838

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- snippet: sourceFile.dot -->
2-
<a id='sourceFile.dot'></a>
2+
<a id='snippet-sourceFile.dot'></a>
33
```dot
44
From Source File
55
```
6-
<sup><a href='#sourceFile.dot' title='Start of snippet'>anchor</a></sup>
6+
<sup><a href='#snippet-sourceFile.dot' title='Start of snippet'>anchor</a></sup>
77
<!-- endSnippet -->

src/Tests/DirectoryMarkdownProcessorTests.Convention.verified.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
\one.md
22
<!-- snippet: snippet1 -->
3-
<a id='snippet1'></a>
3+
<a id='snippet-snippet1'></a>
44
```cs
55
the code from snippet1
66
```
7-
<sup><a href='#snippet1' title='Start of snippet'>anchor</a></sup>
7+
<sup><a href='#snippet-snippet1' title='Start of snippet'>anchor</a></sup>
88
<!-- endSnippet -->
99

1010

@@ -13,11 +13,11 @@ snippet: snippet1
1313

1414
\two.md
1515
<!-- snippet: snippet2 -->
16-
<a id='snippet2'></a>
16+
<a id='snippet-snippet2'></a>
1717
```cs
1818
the code from snippet2
1919
```
20-
<sup><a href='#snippet2' title='Start of snippet'>anchor</a></sup>
20+
<sup><a href='#snippet-snippet2' title='Start of snippet'>anchor</a></sup>
2121
<!-- endSnippet -->
2222

2323

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
The include text <!-- include: fileToInclude.txt -->
22

33
<!-- snippet: snippet1 -->
4-
<a id='snippet1'></a>
4+
<a id='snippet-snippet1'></a>
55
```cs
66
the code from snippet1
77
```
8-
<sup><a href='#snippet1' title='Start of snippet'>anchor</a></sup>
8+
<sup><a href='#snippet-snippet1' title='Start of snippet'>anchor</a></sup>
99
<!-- endSnippet -->
1010
<!-- endInclude -->
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
Local
22

33
<!-- snippet: sourceFile.txt -->
4-
<a id='sourceFile.txt'></a>
4+
<a id='snippet-sourceFile.txt'></a>
55
```txt
66
From Source File
77
```
8-
<sup><a href='/sourceFile.txt#L1-L1' title='Snippet source file'>snippet source</a> | <a href='#sourceFile.txt' title='Start of snippet'>anchor</a></sup>
8+
<sup><a href='/sourceFile.txt#L1-L1' title='Snippet source file'>snippet source</a> | <a href='#snippet-sourceFile.txt' title='Start of snippet'>anchor</a></sup>
99
<!-- endSnippet -->
1010

1111
Relative Local
1212

1313
<!-- snippet: ./sourceFile.txt -->
14-
<a id='./sourceFile.txt'></a>
14+
<a id='snippet-./sourceFile.txt'></a>
1515
```txt
1616
From Source File
1717
```
18-
<sup><a href='#./sourceFile.txt' title='Start of snippet'>anchor</a></sup>
18+
<sup><a href='#snippet-./sourceFile.txt' title='Start of snippet'>anchor</a></sup>
1919
<!-- endSnippet -->
2020

2121
Rooted
2222

2323
<!-- snippet: /sourceFile.txt -->
24-
<a id='/sourceFile.txt'></a>
24+
<a id='snippet-/sourceFile.txt'></a>
2525
```txt
2626
From Source File
2727
```
28-
<sup><a href='/sourceFile.txt#L1-L1' title='Snippet source file'>snippet source</a> | <a href='#/sourceFile.txt' title='Start of snippet'>anchor</a></sup>
28+
<sup><a href='/sourceFile.txt#L1-L1' title='Snippet source file'>snippet source</a> | <a href='#snippet-/sourceFile.txt' title='Start of snippet'>anchor</a></sup>
2929
<!-- endSnippet -->
3030

src/Tests/DirectoryMarkdownProcessorTests.InPlaceOverwriteExists.verified.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!-- snippet: snippet1 -->
2-
<a id='snippet1'></a>
2+
<a id='snippet-snippet1'></a>
33
```cs
44
the code from snippet1
55
```
6-
<sup><a href='#snippet1' title='Start of snippet'>anchor</a></sup>
6+
<sup><a href='#snippet-snippet1' title='Start of snippet'>anchor</a></sup>
77
<!-- endSnippet -->
88

99
The include text <!-- singleLineInclude: fileToInclude.txt -->

src/Tests/DirectoryMarkdownProcessorTests.InPlaceOverwriteNotExists.verified.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!-- snippet: snippet1 -->
2-
<a id='snippet1'></a>
2+
<a id='snippet-snippet1'></a>
33
```cs
44
the code from snippet1
55
```
6-
<sup><a href='#snippet1' title='Start of snippet'>anchor</a></sup>
6+
<sup><a href='#snippet-snippet1' title='Start of snippet'>anchor</a></sup>
77
<!-- endSnippet -->
88

99
The include text <!-- singleLineInclude: fileToInclude.txt -->

src/Tests/DirectoryMarkdownProcessorTests.InPlaceOverwriteUrlSnippet.verified.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- snippet: https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/license.txt -->
2-
<a id='https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/license.txt'></a>
2+
<a id='snippet-https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/license.txt'></a>
33
```txt
44
The MIT License (MIT)
55

@@ -22,5 +22,5 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2222
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2323
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
```
25-
<sup><a href='#https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/license.txt' title='Start of snippet'>anchor</a></sup>
25+
<sup><a href='#snippet-https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/license.txt' title='Start of snippet'>anchor</a></sup>
2626
<!-- endSnippet -->

0 commit comments

Comments
 (0)