Skip to content

Commit

Permalink
fix: allow symbols to be escaped in DocText
Browse files Browse the repository at this point in the history
  • Loading branch information
rmhartog committed May 16, 2024
1 parent 69d6cb7 commit bf80d93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/compiler/src/core/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ export function createScanner(
case CharCode.LineFeed:
return next(Token.NewLine);

case CharCode.Backslash:
return next(Token.DocText, 2);

case CharCode.Space:
case CharCode.Tab:
case CharCode.VerticalTab:
Expand Down
4 changes: 3 additions & 1 deletion packages/compiler/test/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,8 @@ describe("compiler: parser", () => {
* \`\`\`
*
* \`This is not a @tag either because we're in a code span\`.
*
* This is not a \\@tag because it is escaped.
*
* @param x the param
* that continues on another line
Expand All @@ -1036,7 +1038,7 @@ describe("compiler: parser", () => {

strictEqual(
docs[0].content[0].text,
"This one has a `code span` and a code fence and it spreads over\nmore than one line.\n\n```\nThis is not a @tag because we're in a code fence.\n```\n\n`This is not a @tag either because we're in a code span`."
"This one has a `code span` and a code fence and it spreads over\nmore than one line.\n\n```\nThis is not a @tag because we're in a code fence.\n```\n\n`This is not a @tag either because we're in a code span`.\n\nThis is not a @tag because it is escaped."
);
strictEqual(docs[0].tags.length, 6);
const [xParam, yParam, tTemplate, uTemplate, returns, pretend] = docs[0].tags;
Expand Down

0 comments on commit bf80d93

Please sign in to comment.