Skip to content

feat: GitHub style callouts #2487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests for new callout syntax
  • Loading branch information
jhildenbiddle authored and sy-records committed Aug 11, 2024
commit 6cf5f36943214a527f648937fb8db424d8ec51e1
46 changes: 43 additions & 3 deletions test/integration/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,60 @@ import { waitForText } from '../helpers/wait-for.js';
describe('render', function () {
// Helpers
// ---------------------------------------------------------------------------
describe('helpers', () => {
describe('callouts', () => {
beforeEach(async () => {
await docsifyInit();
});

test('important content', () => {
test('caution', () => {
const output = window.marked('> [!CAUTION]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout caution"><p>Text</p></div>"`,
);
});

test('important', () => {
const output = window.marked('> [!IMPORTANT]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout important"><p>Text</p></div>"`,
);
});

test('note', () => {
const output = window.marked('> [!NOTE]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout note"><p>Text</p></div>"`,
);
});

test('tip', () => {
const output = window.marked('> [!TIP]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout tip"><p>Text</p></div>"`,
);
});

test('warning', () => {
const output = window.marked('> [!WARNING]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout warning"><p>Text</p></div>"`,
);
});

test('important (legacy)', () => {
const output = window.marked('!> Important content');

expect(output).toMatchInlineSnapshot(
`"<p class="callout important">Important content</p>"`,
);
});

test('general tip', () => {
test('tip (legacy)', () => {
const output = window.marked('?> General tip');

expect(output).toMatchInlineSnapshot(
Expand Down
Loading