securemark 0.294.6 → 0.294.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.js +226 -216
- package/markdown.d.ts +13 -36
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.ts +2 -2
- package/src/combinator/control/constraint/line.ts +7 -5
- package/src/combinator/control/manipulation/convert.ts +2 -1
- package/src/combinator/control/manipulation/fence.ts +4 -4
- package/src/combinator/control/manipulation/indent.ts +3 -5
- package/src/combinator/control/manipulation/surround.ts +47 -18
- package/src/combinator/data/parser/some.ts +1 -1
- package/src/combinator/data/parser/union.ts +6 -2
- package/src/parser/api/bind.test.ts +0 -1
- package/src/parser/api/normalize.test.ts +5 -8
- package/src/parser/api/normalize.ts +11 -11
- package/src/parser/api/parse.test.ts +3 -3
- package/src/parser/autolink.ts +1 -2
- package/src/parser/block/extension/fig.ts +4 -1
- package/src/parser/block/heading.ts +12 -2
- package/src/parser/block/reply/quote.ts +1 -2
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/block.ts +0 -4
- package/src/parser/header.ts +28 -40
- package/src/parser/inline/annotation.ts +2 -3
- package/src/parser/inline/autolink/account.ts +47 -17
- package/src/parser/inline/autolink/anchor.test.ts +0 -1
- package/src/parser/inline/autolink/anchor.ts +15 -15
- package/src/parser/inline/autolink/email.test.ts +1 -1
- package/src/parser/inline/autolink/email.ts +10 -11
- package/src/parser/inline/autolink/hashnum.ts +17 -14
- package/src/parser/inline/autolink/hashtag.ts +23 -19
- package/src/parser/inline/autolink/url.ts +24 -19
- package/src/parser/inline/autolink.ts +36 -25
- package/src/parser/inline/bracket.ts +14 -14
- package/src/parser/inline/deletion.ts +2 -1
- package/src/parser/inline/emphasis.ts +2 -1
- package/src/parser/inline/emstrong.ts +2 -1
- package/src/parser/inline/extension/index.ts +4 -4
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/extension/label.ts +1 -1
- package/src/parser/inline/extension/placeholder.ts +4 -3
- package/src/parser/inline/html.ts +5 -5
- package/src/parser/inline/htmlentity.ts +3 -3
- package/src/parser/inline/insertion.ts +2 -1
- package/src/parser/inline/italic.ts +2 -1
- package/src/parser/inline/link.ts +7 -20
- package/src/parser/inline/mark.ts +2 -1
- package/src/parser/inline/math.ts +4 -2
- package/src/parser/inline/media.ts +24 -25
- package/src/parser/inline/reference.ts +4 -4
- package/src/parser/inline/remark.ts +2 -1
- package/src/parser/inline/ruby.ts +3 -4
- package/src/parser/inline/strong.ts +2 -1
- package/src/parser/inline/template.ts +10 -10
- package/src/parser/inline.ts +2 -1
- package/src/parser/segment.ts +2 -2
- package/src/parser/source/escapable.ts +3 -4
- package/src/parser/source/line.ts +3 -1
- package/src/parser/source/text.ts +8 -13
- package/src/parser/source/unescapable.ts +2 -4
- package/src/parser/source.ts +1 -2
- package/src/parser/inline/autolink/channel.ts +0 -44
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { AutolinkParser } from '../../inline';
|
|
2
|
-
import { State, Backtrack } from '../../context';
|
|
3
|
-
import { List, Data } from '../../../combinator/data/parser';
|
|
4
|
-
import { union, sequence, some, state, constraint, verify, rewrite, surround, convert, fmap, lazy } from '../../../combinator';
|
|
5
|
-
import { unsafelink } from '../link';
|
|
6
|
-
import { emoji } from './hashtag';
|
|
7
|
-
import { str } from '../../source';
|
|
8
|
-
import { define } from 'typed-dom/dom';
|
|
9
|
-
|
|
10
|
-
// https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
|
|
11
|
-
|
|
12
|
-
export const channel: AutolinkParser.ChannelParser = lazy(() => rewrite(
|
|
13
|
-
sequence([
|
|
14
|
-
surround(
|
|
15
|
-
/(?<![0-9a-z])@/yi,
|
|
16
|
-
str(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi),
|
|
17
|
-
str(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi),
|
|
18
|
-
true, undefined, undefined,
|
|
19
|
-
[3 | Backtrack.autolink]),
|
|
20
|
-
some(verify(surround(
|
|
21
|
-
'#',
|
|
22
|
-
str(new RegExp([
|
|
23
|
-
/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source,
|
|
24
|
-
].join('').replace(/emoji/g, emoji.source), 'yu')),
|
|
25
|
-
str(new RegExp([
|
|
26
|
-
/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source,
|
|
27
|
-
].join('').replace(/emoji/g, emoji.source), 'yu')),
|
|
28
|
-
false, undefined, undefined,
|
|
29
|
-
[3 | Backtrack.autolink]),
|
|
30
|
-
([{ value }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value as string))),
|
|
31
|
-
]),
|
|
32
|
-
constraint(State.autolink, state(State.autolink, fmap(convert(
|
|
33
|
-
source =>
|
|
34
|
-
`[${source}]{ ${source.includes('/')
|
|
35
|
-
? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}`
|
|
36
|
-
: `/${source.slice(0, source.indexOf('#'))}`
|
|
37
|
-
} }`,
|
|
38
|
-
union([unsafelink]),
|
|
39
|
-
false),
|
|
40
|
-
([{ value: el }], { source, position, range = 0 }) => {
|
|
41
|
-
const src = source.slice(position - range, position);
|
|
42
|
-
const url = `${el.getAttribute('href')}?ch=${src.slice(src.indexOf('#') + 1).replace(/#/g, '+')}`;
|
|
43
|
-
return new List([new Data(define(el, { class: 'channel', href: url }, src))]);
|
|
44
|
-
})))));
|