Skip to content

fix: shared default lexer state by cloning effective options during lexer construction#1

Open
codefix-patchflow[bot] wants to merge 1 commit into
masterfrom
codefix/c312b1cb-describe-the-bug
Open

fix: shared default lexer state by cloning effective options during lexer construction#1
codefix-patchflow[bot] wants to merge 1 commit into
masterfrom
codefix/c312b1cb-describe-the-bug

Conversation

@codefix-patchflow

Copy link
Copy Markdown

What failed

Describe the bug import { marked } from "marked"; const lexer = new marked.Lexer(); const tokensA = marked.Lexer.lex("Test"); const tokensB = lexer.lex("Test"); The values of tokensA and tokensB should be the same instead tokensA is [ { "type": "paragraph", "raw": "Test", "text": "Test", "tokens": [ { "type": "text", "raw": "Test", "text": "Test", "escaped": false } ] } ] as expected but tokensB is [ { "type": "paragraph", "raw": "Test", "text": "Test", "tokens": [] } ] The problem is probably related to the shared defaults option object To Reproduce Steps to reproduce the behavior: Run the code above Expected behavior I would expect both options to give the same result

What changed

Fixed shared default lexer state by cloning effective options during lexer construction

  • src/Lexer.ts around line 24 (modified, +1/-1)

Why this works

The patch is scoped to the failing path and preserves existing behavior outside the touched code.

Expected result

A concise pull request is created with a clear review note

Patchflow did not run repository-local commands; the automated review gate checks the patch without assuming the project full runtime environment is available.

🔧 Fixed automatically by Patchflow — $1/fix · no fix, no fee

Automation details
  • Job ID: c312b1cb-63a3-4e53-b3ef-0bd158116bc2
  • Repository: CDEN190/marked
  • Branch: codefix/c312b1cb-describe-the-bug
  • Base branch: master
  • Reference command: None
  • Review gate: automated static review; repository-local commands were not executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants