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

yunnysunny / bookforge / 22036642206

15 Feb 2026 01:38PM UTC coverage: 70.995% (+14.8%) from 56.206%
22036642206

Pull #2

github

yunnysunny
feat: fix html generate test
Pull Request #2: feat: refactor ui flow

63 of 81 branches covered (77.78%)

Branch coverage included in aggregate %.

98 of 169 new or added lines in 13 files covered. (57.99%)

4 existing lines in 3 files now uncovered.

358 of 512 relevant lines covered (69.92%)

27.05 hits per line

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

30.0
/src/core/marked-plugins/gitbook-stepper.plugin.ts
1
import type { RendererThis, MarkedExtension, Tokens } from 'marked';
2

3
interface StepperItem {
4
  title: string;
5
  content: string;
6
  tokens: Tokens.Generic[];
7
}
8
interface GitbookStepperToken extends Tokens.Generic {
9
  type: 'gb-stepper';
10
  tag: 'stepper';
11
  items: StepperItem[];
12
}
13
export const gitbookStepperExtension: MarkedExtension = {
15✔
14
  extensions: [
15
    {
16
      name: 'gb-stepper',
17
      level: 'block',
18
      start(src: string) {
19
        return src.indexOf('{%');
42✔
20
      },
21
      tokenizer(this, src: string): GitbookStepperToken | undefined {
22
        const rule = /^\{%\s*stepper\s*%\}([\s\S]*?)\{%\s*endstepper\s*%\}/;
99✔
23
        const match = rule.exec(src);
99✔
24
        if (!match) return;
99✔
25

NEW
26
        const [, content] = match;
×
27

NEW
28
        const stepRegex = /\{%\s*step\s*%\}([\s\S]*?)\{%\s*endstep\s*%\}/g;
×
NEW
29
        const stepItems: StepperItem[] = [];
×
NEW
30
        let matchStep: RegExpExecArray | null = stepRegex.exec(content);
×
NEW
31
        while (matchStep !== null) {
×
NEW
32
          stepItems.push({
×
33
            title: matchStep[1],
34
            content: matchStep[2],
35
            tokens: this.lexer.blockTokens(matchStep[1]),
36
          });
NEW
37
          matchStep = stepRegex.exec(content);
×
38
        }
39

NEW
40
        return {
×
41
          type: 'gb-stepper',
42
          tag: 'stepper',
43
          raw: match[0],
44
          items: stepItems,
45
        };
46
      },
47
      renderer(this: RendererThis<string, string>, token: Tokens.Generic) {
NEW
48
        const { tag, items: stepItems, raw } = token as GitbookStepperToken;
×
NEW
49
        if (!tag || !stepItems || stepItems.length === 0) {
×
NEW
50
          return raw;
×
51
        }
NEW
52
        return `<div class="gb-stepper">
×
53
          ${stepItems
54
            .map((item, index) => {
NEW
55
              return `
×
56
              <div class="step">
57
                <div class="step-marker">
58
                  <span class="step-number">${index + 1}</span>
59
                  <span class="step-line"></span>
60
                </div>
61
                <div class="step-content">${this.parser.parse(item.tokens)}</div>
62
              </div>
63
              `;
64
            })
65
            .join('\n')}
66
        </div>`;
67
      },
68
    },
69
  ],
70
};
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