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

jfcere / ngx-markdown / 1d74f11f-e24c-450c-8833-c4f1753d8817

08 Nov 2023 02:17AM CUT coverage: 96.939% (-0.3%) from 97.194%
1d74f11f-e24c-450c-8833-c4f1753d8817

push

circleci

web-flow
chore: update to marked version 9 (#474)

* chore: update to marked version 9

a new token `MARKDOWN_EXTENSIONS` has been added to provide extensions to marked
usage example
```
{
  provide: MARKDOWN_EXTENSIONS,
  useValue: [gfmHeadingId()],
}
```

update `readme.md` file
- removed from the examples all the options that were removed
- added section for the new marked extension token
- removed the part that we need to add node_modules/marked/marked.min.js to our scripts since it's not needed

breaking change
- all options that were removed from marked has been deleted from this library too, see more at https://marked.js.org/using_advanced#options
- some methods now return `Promise<string>` instead of `string`, because marked is doing so
- `srcRelativeLink` input is removed as the baseUrl option has been removed from marked, use https://www.npmjs.com/package/marked-base-url instead

* Update README.md

* test: fix the Marked testing by providing it using Angular dependency rejection

so it's possible to override it in the unit test
it starts with ɵ so IDE doesn't provide it in autocomplete suggestions

* feat: add `extensions` to the `MarkdownModuleConfig`

remove unused `loader` from the `MarkdownModuleConfig`

* Revert "feat: add `extensions` to the `MarkdownModuleConfig`"

This reverts commit be713bf63.

* Re-add extensions to the MarkdownModuleConfig

* Add missing unit tests

---------

Co-authored-by: jfcere <jfcere@sherweb.com>

98 of 106 branches covered (0.0%)

Branch coverage included in aggregate %.

15 of 15 new or added lines in 5 files covered. (100.0%)

282 of 286 relevant lines covered (98.6%)

21.24 hits per line

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

100.0
/lib/src/clipboard-button.component.ts
1
import { ChangeDetectionStrategy, Component } from '@angular/core';
2
import { merge, of, Subject, timer } from 'rxjs';
3
import { distinctUntilChanged, map, mapTo, shareReplay, startWith, switchMap } from 'rxjs/operators';
4

5
const BUTTON_TEXT_COPY = 'Copy';
1✔
6
const BUTTON_TEXT_COPIED = 'Copied';
1✔
7

8
@Component({
9
  selector: 'markdown-clipboard',
10
  template: `
11
    <button
12
      class="markdown-clipboard-button"
13
      [class.copied]="copied$ | async"
14
      (click)="onCopyToClipboardClick()"
15
    >{{ copiedText$ | async }}</button>
16
  `,
17
  changeDetection: ChangeDetectionStrategy.OnPush,
18
})
19
export class ClipboardButtonComponent {
1✔
20

21
  private _buttonClick$ = new Subject<void>();
4✔
22

23
  readonly copied$ = this._buttonClick$.pipe(
4✔
24
    switchMap(() => merge(
2✔
25
      of(true),
26
      timer(3000).pipe(mapTo(false)),
27
    )),
28
    distinctUntilChanged(),
29
    shareReplay(1),
30
  );
31

32
  readonly copiedText$ = this.copied$.pipe(
4✔
33
    startWith(false),
34
    map(copied => copied
8✔
35
      ? BUTTON_TEXT_COPIED
36
      : BUTTON_TEXT_COPY),
37
  );
38

39
  onCopyToClipboardClick(): void {
40
    this._buttonClick$.next();
2✔
41
  }
42
}
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

© 2025 Coveralls, Inc