• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gregreindel / llm-exe / 14959447316

11 May 2025 08:30PM UTC coverage: 99.551%. First build
14959447316

Pull #61

github

web-flow
Merge ff0b29e8a into a88aa8a8a
Pull Request #61: Update defaults

931 of 937 branches covered (99.36%)

Branch coverage included in aggregate %.

55 of 56 new or added lines in 15 files covered. (98.21%)

2170 of 2178 relevant lines covered (99.63%)

29.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/parser/parsers/MarkdownCodeBlocks.ts
1
import { BaseParserOptions } from "@/types";
2
import { BaseParser } from "../_base";
24✔
3
import { isObjectStringified } from "@/utils";
24✔
4
import { singleKeyObjectToString } from "../singleKeyObjectToString";
24✔
5

6
export interface MarkdownCodeBlocksParserOptions extends BaseParserOptions {}
7

8
export class MarkdownCodeBlocksParser extends BaseParser<
24✔
9
  { language: string; code: string }[]
10
> {
11
  constructor(options?: MarkdownCodeBlocksParserOptions) {
12
    super("markdownCodeBlocks", options);
6✔
13
  }
14
  parse(input: string) {
15
    const out: { code: string; language: string }[] = [];
4✔
16

17
    // If input is JSON, decode it first
18
    // grok seems to want to return JSON code blocks
19
    // if others do, this can't hurt
20
    if (isObjectStringified(input)) {
4!
NEW
21
      input = singleKeyObjectToString(input);
×
22
    }
23

24
    const regex = input.matchAll(new RegExp(/```(\w*)\n([\s\S]*?)```/, "g"));
4✔
25
    for (const iterator of regex) {
4✔
26
      if (iterator) {
3✔
27
        const [_input, language, code] = iterator;
3✔
28
        out.push({
3✔
29
          language,
30
          code,
31
        });
32
      }
33
    }
34
    return out;
4✔
35
  }
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc