-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Identify source code referenced by line number
The current build system allows code snippets from an external repository to be imported into individual articles based on their line numbers. The following:
- Import a range of lines using a # query string. This takes the form #Lstart-Lend.
56 files use line numbers in the dotnet/docs repo; there are none in the dotnet/dotnet-api-docs repo. - Import a range of lines using a ? query string. This takes the form ?start=start&end=end.
There are none in either the dotnet/docs or the dotnet/dotnet-api-docs repos. - Import multiple non-contiguous regions. This takes the form ?range=query-range. For example,
?range=1-3,7causes lines 1-3 and 7 to appear without an intervening break.
1 file uses ranges in 2 source code files in the dotnet/docs repo; there are none in the dotnet/dotnet-api-docs repo. - Highlight a range of lines. This takes the form ?highlight=range-query.
There are a total of 19 affected files in both dotnet/docs and dotnet/dotnet-api-docs.
Because code that is imported based on line numbers is brittle (when source code is inadvertently changed by adding or deleting lines, the source articles display incorrect blocks of code), it is important to identify source code that is referenced by line number.
To do this, we must:
-
Identify all source code files in both dotnet/docs and dotnet/dotnet-api-docs that are referenced by line number.
-
Add a file named access-by-line.txt to the directory that contains the source code file. The file should indicate which source code file is accessed by line number, as well as the path and name of the content file that references it.
Each item takes the form:
[source-code-file]: [path-to-article-referencing-it]A sample file might appear as follows:
program.cs: ~/docs/csharp/tour-of-csharp/arrays.md program.cs: ~/docs/csharp/tour-of-csharp/attributes.md