/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/muya/src/utils/__tests__/firstWordOfInfo.spec.ts
21 строка
731 B
Ran Luo
refactor(muya): treat the code fence info string as the source of truth (CommonMark) (#4856)
05 июл 2026, 03:04
Не верифицирован
05 июл 2026, 03:04
42c87f0
Код
Авторство
О чём код?
import { describe, expect, it } from 'vitest'; import { firstWordOfInfo } from '../index'; describe('firstWordOfInfo', () => { it('returns the whole word for a plain language', () => { expect(firstWordOfInfo('js')).toBe('js'); }); it('returns the first word for a language + attributes', () => { expect(firstWordOfInfo('js title="app.js"')).toBe('js'); }); it('returns the first token for a Pandoc-style attribute block', () => { expect(firstWordOfInfo('{example, listing1-name}')).toBe('{example,'); }); it('returns empty string for empty / whitespace info', () => { expect(firstWordOfInfo('')).toBe(''); expect(firstWordOfInfo(' ')).toBe(''); }); });