@@ -1102,22 +1102,6 @@ func renderNote(name, description, body string) string {
11021102 return b .String ()
11031103}
11041104
1105- // splitFrontmatter returns the description and the body. A note without
1106- // frontmatter is not an error — it is a file someone wrote by hand, and losing
1107- // it because it lacks a header would be the store punishing the reader it exists
1108- // to serve.
1109- //
1110- // CRLF is accepted as well as LF. Project-scope notes are checked in, and Git for
1111- // Windows defaults to autocrlf=true, so a note that merely round-trips through a
1112- // clone comes back with "---\r\n" — under an LF-only split the whole header,
1113- // delimiters included, fell through into the body and the description was lost.
1114- //
1115- // LINE ENDINGS ARE NORMALISED TO LF in what this returns, on every path. The
1116- // earlier version normalised only for the split and then returned the body from
1117- // whichever string that path happened to hold, so a note WITH frontmatter came
1118- // back as LF and one WITHOUT kept its CRLF — a difference no caller asked for and
1119- // nothing documented. The file on disk is untouched either way; this is only
1120- // what the reader is handed.
11211105// boundedDescription caps the summary so one note cannot crowd out the listing.
11221106// Truncated on a rune boundary with an ellipsis, so the result stays readable and
11231107// is visibly cut rather than looking like the whole of a short description.
@@ -1147,6 +1131,22 @@ func boundedDescription(text string) string {
11471131 return text [:cut ] + ellipsis
11481132}
11491133
1134+ // splitFrontmatter returns the description and the body. A note without
1135+ // frontmatter is not an error — it is a file someone wrote by hand, and losing
1136+ // it because it lacks a header would be the store punishing the reader it exists
1137+ // to serve.
1138+ //
1139+ // CRLF is accepted as well as LF. Project-scope notes are checked in, and Git for
1140+ // Windows defaults to autocrlf=true, so a note that merely round-trips through a
1141+ // clone comes back with "---\r\n" — under an LF-only split the whole header,
1142+ // delimiters included, fell through into the body and the description was lost.
1143+ //
1144+ // LINE ENDINGS ARE NORMALISED TO LF in what this returns, on every path. The
1145+ // earlier version normalised only for the split and then returned the body from
1146+ // whichever string that path happened to hold, so a note WITH frontmatter came
1147+ // back as LF and one WITHOUT kept its CRLF — a difference no caller asked for and
1148+ // nothing documented. The file on disk is untouched either way; this is only
1149+ // what the reader is handed.
11501150func splitFrontmatter (content string ) (description string , body string ) {
11511151 normalized := strings .ReplaceAll (content , "\r \n " , "\n " )
11521152 if ! strings .HasPrefix (normalized , "---\n " ) {
0 commit comments