securemark 0.286.1 → 0.286.3
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/design.md +59 -16
- package/dist/index.js +50 -45
- package/markdown.d.ts +1 -1
- package/package.json +1 -1
- package/src/combinator/control/manipulation/surround.ts +0 -1
- package/src/parser/api/parse.test.ts +8 -6
- package/src/parser/context.ts +10 -8
- package/src/parser/inline/autolink/hashnum.test.ts +2 -1
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.test.ts +10 -11
- package/src/parser/inline/autolink/hashtag.ts +2 -2
- package/src/parser/inline/autolink/url.ts +6 -6
- package/src/parser/inline/autolink.ts +5 -5
- package/src/parser/inline/deletion.ts +4 -3
- package/src/parser/inline/emphasis.ts +4 -4
- package/src/parser/inline/emstrong.ts +4 -3
- package/src/parser/inline/extension/index.ts +6 -6
- package/src/parser/inline/extension/placeholder.ts +4 -4
- package/src/parser/inline/html.ts +6 -6
- package/src/parser/inline/insertion.ts +4 -3
- package/src/parser/inline/italic.ts +5 -3
- package/src/parser/inline/link.test.ts +1 -0
- package/src/parser/inline/mark.ts +5 -4
- package/src/parser/inline/math.ts +4 -3
- package/src/parser/inline/reference.ts +6 -1
- package/src/parser/inline/remark.ts +4 -3
- package/src/parser/inline/ruby.test.ts +2 -1
- package/src/parser/inline/ruby.ts +18 -10
- package/src/parser/inline/strong.ts +4 -4
- package/src/parser/inline/template.ts +6 -6
- package/src/parser/inline.test.ts +9 -8
- package/src/parser/source/str.ts +4 -1
- package/src/parser/source/text.ts +2 -2
package/CHANGELOG.md
CHANGED
package/design.md
CHANGED
|
@@ -206,6 +206,10 @@ HTMLEntity構文はエンティティ追加時の互換性確保のため不正
|
|
|
206
206
|
また他の構文と同じ視覚表現で異なる意味付けを行うHTMLタグを追加してはならない。
|
|
207
207
|
ディレクティブなど文書でなくページを記述するための構文を追加してはならない。
|
|
208
208
|
|
|
209
|
+
### クラス化制約
|
|
210
|
+
|
|
211
|
+
他の構文を内部構文として包含可能な類似の構文は先行する構文の解析結果を利用してバックトラックを抑制できるよう構文を先行する類似構文のサブクラスおよび後行する類似構文のスーパークラスとして設計しなければならない。
|
|
212
|
+
|
|
209
213
|
## スケーラビリティ
|
|
210
214
|
|
|
211
215
|
パーサーおよびレンダラーはドキュメントサイズの増大により以下の利用性を損なってはならない。
|
|
@@ -277,7 +281,7 @@ HTMLEntity構文はエンティティ追加時の互換性確保のため不正
|
|
|
277
281
|
|
|
278
282
|
### AST(CST)
|
|
279
283
|
|
|
280
|
-
Securemarkはブロック単位の差分更新によりリアルタイムレンダリングを高速化しているがCST
|
|
284
|
+
Securemarkはブロック単位の差分更新によりリアルタイムレンダリングを高速化しているがCSTを生成する場合行の追加削除により以降すべてのノードの位置情報を更新する必要が生じ許容範囲を超える遅延が生じる可能性がある。このためこの最適化を行う必要があるが行位置の更新のみであればこれのみを行う処理経路の追加は容易であろう。Markdownでも行数は数万行以下と想定できることから行数を全ノードに直接記述せず行ノードの行数を参照する実装に変更すれば更新対象を数万以下の行ノードだけに局限できる。これらは数百行以下に規律されるソースコードにおいては生じない問題であり数十万文字を許容しなければならないマークアップ言語に新出の問題であるため新規にCSTの設計および運用を再考する必要がある。
|
|
281
285
|
|
|
282
286
|
またBlockquote構文を内包テキストまでシンタックスハイライトする場合、構文(>)と内包テキストが垂直に分割されるため構文と1対1で対応する単純なノードではCSTを表現できず構文の断片を表現するノードが必要となり、さらにこれをエディタ上でシンタックスハイライトするためのHTMLに変換する際に各行においてこの断片のCSTを断片のHTMLに正しく変換および表示しなければならずかなり煩雑な作業を要する。
|
|
283
287
|
|
|
@@ -285,15 +289,15 @@ CodeMirrorが素では速いがVimModeでは数万文字程度でも耐え難く
|
|
|
285
289
|
|
|
286
290
|
### バックトラック
|
|
287
291
|
|
|
288
|
-
SecuremarkのAnnotation
|
|
289
|
-
CommonMark
|
|
290
|
-
|
|
291
|
-
Securemarkは線形時間で解析不能な文脈依存言語をおおよそ13nの最悪時間計算量に改善しさらに解析時間と解析範囲の局限により一定時間内で解析不能な入力の影響を局限することでこれらの問題を解決している。この解析方法はほとんどの自然な入力に対して1nに近い時間で効率的に動作し、最悪計算量で低速に動作させる入力に対してもこの開発効率と安全性優先の低速な実装においてはサーバーで多数のユーザーのリクエストに応じるには低速で脆弱性となる可能性があるがクライアントで単一のユーザーの操作に応じるには十分高速であるためクライアントで解析する限り解析の効率または速度が実用上問題となることはなく仕様が固まり実行効率優先の高速な実装に移れば速度面の懸念もないだろう。
|
|
292
|
+
SecuremarkのAnnotation構文に典型的であるように文脈を変更する構文の中にその文脈に依存し変更される他の構文が存在する場合文脈の相違から解析結果を再利用不能(`αAβ | αA'B`)なバックトラックが生じる。またこの結果再帰的バックトラックが生じる可能性があり再帰的バックトラックは一般的にメモ化により解決されるがCommonMarkは実行性能追及のためメモ化を廃止しているためメモ化により性能を低下させてまで文脈依存構文の問題を解決するつもりはないと思われる(すなわちCommonMarkは機械を至上とし人間に制約を課す低水準の言語であり人間の需要を至上とするSecuremarkとは対極に位置する)。従って現在の再帰的バックトラックなしで解析可能な構文と最小計算量に制約されるCommonMarkにはこれ以上再帰的バックトラックが生じる可能性を増加させて文脈依存構文を追加できないという拡張性の欠陥が存在する。CommonMarkの仕様策定者が構文の拡張に(名称を維持するか否かにかかわらず)不自然なまでに消極的または進展がないのは正当な理由や怠慢からでなく文脈依存構文を追加するにつれて構文解析戦略の失敗が明白になっていくためおよび現在の高い実行性能を低下させたくないためであり陳腐な自尊心を守るためにこのような拡張性の欠陥を秘匿しCommonMarkとその仕様策定者である自分の評価が下がらないよう画策しているからである。でなければ何年も隠さず速やかにこの拡張性の欠陥を公表して助力を求めていなければならず不都合な事実を隠し全Markdown利用者および開発者を不必要に足止めした罪は重い。CommonMarkは`~~a~~`のような文脈自由構文は容易に追加できるがこうしたマージンを失えばもはや後はない。
|
|
293
|
+
CommonMarkは小さく単純であるがゆえに正しくいられる象牙の塔であり仕様策定者はこの正しさを失わず正しいままでいたいがために象牙の塔に引きこもり小さな表面的完全性に固執し続けているに過ぎない。しかし実際にはCommonMarkはまったく完全ではなく本来文脈依存構文である構文を文脈自由構文として解析しているため破綻している部分があり実際のところCommonMarkは最初から現在までずっと壊れている。またCommonMarkはバックトラックなく最小計算量で解析するために文脈自由言語として設計されているが実際には文脈依存言語であるMarkdownから文脈依存構文を文脈自由構文に変換して除去することができずCommonMarkは最初の数年間は再帰的バックトラックに気づかず最悪計算量が指数関数計算量になっており修正後は最悪計算量が当初の想定の1nから32nへと32倍に劇的に悪化している。CommonMarkは未だにバックトラックを忌避し1nの最小計算量に固執しているがそんなものはとっくの昔に破綻してるのを未練がましく執着しているだけである。最悪計算量が32nにまで悪化するのであれば計算量が少ないよう適切に設計された文脈依存言語と大差なく最初から文脈依存言語として適切に設計するほうが自然で破綻がなく拡張性を確保できていた。文脈依存構文を強引に文脈自由構文として解析して最悪計算量が当初の想定の1nから32nに劇的に悪化し結局文脈依存言語の妥当な最悪計算量の水準に落ちていることから文脈自由言語として設計されたCommonMarkの破綻と失敗は明らかでありCommonMarkは文脈自由構文に固執せず最初から多少の文脈依存構文を許容するよう設計しなければならなかった。実際には文脈依存言語であるにもかかわらず文脈自由言語としてしか構文解析できなければ構文解析が破綻し構文が増えるほど破綻が拡大することは自明でありすでに破綻済みで失敗済みのCommonMarkに未来などない。文脈依存言語であるMarkdownに対して文脈自由構文解析器として作られたCommonMarkは最初から技術選択を間違え失敗しており最初から破綻していた。Markdownを文脈自由言語として解析しようとして行き詰ったCommonMarkとその閉塞に技術的合理性はなくCommonMarkは最初からの失敗していた過去の遺物であり廃棄すべき負債である。CommonMarkに動きがないのはすでに破綻しており死んでいることに気付かれないように死んでいるからに過ぎない。このようにCommonMarkは完全に破綻し失敗に終わっているためCommonMarkの拡張や発展を期待しても無駄であり既存の文脈依存構文による破綻がなく新たに文脈依存構文を追加可能な拡張性の高いMarkdown仕様は新しく作り直さなければ作れない。しかしCommonMarkの仕様策定者は独自の新しい仕様においてもMarkdownをバックトラックを排除した文脈自由言語として設計しているため救いようがない。しかもその構文と仕様は機械可読性を至上としているため非常に醜く人間が書くことも読むことも困難で実用性の欠如したものである。
|
|
294
|
+
Securemarkはスーパークラス構文が解析に失敗した入力をサブクラス構文で解析しないことにより再帰的バックトラックを回避する(ここで解析中の構文自身はスーパークラスとサブクラスの両方に含まれるものとする)。スーパークラス構文A(`αAβ`)の解析が失敗すればサブクラス構文B(`α'A'β'`)の解析も失敗することは自明であり解析を試みるまでもなく省略できる。これは構文の文法が生成する言語空間がスーパーセットとサブセットの関係にあるならスーパーセットの言語空間の外にある文字列はサブセットの言語空間の内に入る余地がないことからも自明である(この解析法は事前処理によっても可能だが文脈内外のオートリンクURLの括弧解析などを高速に行うことは困難であるためMarkdownをこの事前処理により高速化することは難しい)。メモ化は解析結果を再利用することで結果的に副次的効果としてバックトラックを回避しているのでありメモ化はバックトラックを回避するだけなら過剰機能であり不要である(メモ化はバックトラックがなければ使用されないためバックトラックの少ないほとんどの入力に対してはほとんど使用されず無駄であり空間計算量を常に不必要に数倍以上に増加させてまで行う利益は少ないことから構文解析において必須ではない。バックトラック回避のためにメモ化するとバックトラックなしで解析可能な場合も常に不必要に空間計算量が増加することがメモ化の最大の欠点である。特に文脈自由構文解析器におけるメモ化の使用は完全に無駄でありバグである。バックトラックが他の方法で解決されるならば最終的に文脈ごと破棄され使用されないメモ化も無駄であり複数の文脈で解析結果が同一である文脈独立性のある構文ならメモ化した解析結果を異なる文脈で再利用でき有用だがそのような構文は基本的に少数であるため効果が限定的であり最悪計算量は改善されない)。この独自の解析法によりSecuremarkはメモ化なしに線形時間で解析不能な文脈依存言語をメモ化なしでおおよそ14nの最悪時間計算量に改善しさらに一定時間内で解析不能な入力の影響を解析時間と解析範囲の局限することで解決している。この解析方法はほとんどの自然な入力に対して1nに近い時間で効率的に動作し、最悪計算量で低速に動作させる入力に対してもこの開発効率と安全性優先の低速な実装をサーバーで使用し多数のユーザーのリクエストに応じるには低速で脆弱性となる可能性があるがクライアントで個別のユーザーの操作に応じるには十分高速であるためクライアントで解析する限り解析の効率または速度が実用上問題となることはなく仕様が固まり実行効率優先の高速な実装に移れば速度面の懸念もないだろう。またSecuremarkはメモ化を行っていないため実装依存の非効率性を除けば空間計算量も小さく、異なる構文や状態の解析結果を利用して未知の入力に対してもバックトラックを回避できるためメモ化より時間計算量が小さい。時間計算量と空間計算量を合わせてO(n, n)と表記すると文脈依存言語の通常の最悪計算量はO(n^2, n)、メモ化により効率化できた場合もO(nm, nm)(解析結果の構文木等を記録するため空間使用量S(m)>=m byte)に過ぎないがSecuremarkの非再帰構文解析法はO(nm, n + nm)(解析失敗のフラグしか記録しないためS(m)=m bit。なお成功フラグによる解析は解析済みかの情報が追加で必要になり処理が複雑化かつほとんどの成功した解析に対してメモリ消費と追加処理が発生し解析効率が全体として悪化するが失敗フラグは少数の失敗した解析でしか解析効率が悪化しないため失敗フラグを記録するほうが全体として解析効率が高く優れている)と極めて効率的であり最も優れている。なお現在のSecuremarkは開発効率優先の実装により空間計算量が低下しているが時間計算量は低下せずメモ化より優れている。またSecuremarkの再帰数制限はパーサーコンビネーターの使用による実装依存の制限であるため再帰が生じないよう書き換えれば再帰数制限もない。SecuremarkをCommonMarkのような再帰数制限のない実装に変換することは設計上何の支障もないがCommonMarkをSecuremarkのような文脈依存言語解析器に変更することは根本的な設計変更なしに不可能である。例えば二重リンク`[[]()]()`を解析するときCommonMarkはバックトラックと計算量を最小化すべく文脈自由構文解析器として設計されているためリンク構文内を異なる文脈として解析せず外側のリンク構文の解析を破棄して内側のみリンクとして解析するがSecuremarkは文脈依存構文解析器とし設計されているため内側のリンク構文を無効化して外側のみリンクとして解析する。旧構文だけ従来通り文脈自由構文として解析し新構文を文脈依存構文として解析することも不可能ではないが構文としても解析器としてもキメラ的な非常に不自然で歪なものとなり解析規則の一貫性のなさによりユーザーを混乱させることになる。いずれにせよCommonMarkはこのような根本的設計変更なしに文脈依存構文解析器に変更して拡張性を確保することはできないためMarkdownは素直にCommonMarkの文脈自由言語特有の解析規則を捨てて素直な文脈依存構文言語として新しい仕様を作るのが賢明である。
|
|
292
295
|
|
|
293
296
|
### 最適化
|
|
294
297
|
|
|
295
|
-
-
|
|
296
|
-
-
|
|
298
|
+
- パーサー出力の木構造化とDOM出力の分離による、生成とバックトラックのコストの削減
|
|
299
|
+
- パーサーの展開またはトランポリン化
|
|
300
|
+
- 差分更新可能かつ利用環境に適合するCSTの開発
|
|
297
301
|
|
|
298
302
|
### 標準化
|
|
299
303
|
|
|
@@ -304,17 +308,56 @@ Markdownのように自然言語と自身の文法を分離する汎用構造が
|
|
|
304
308
|
|
|
305
309
|
よってMarkdownの標準化は後方互換性確保が不可能であることから発展性がなくスナップショット以上の技術的意味を持たない。
|
|
306
310
|
MarkdownはGFMのように最初から高機能で完成度の高い拡張不要な独自実装のほうが標準としての互換性を確保でき、構文に曖昧さがない形式言語と異なりまず最小限の標準仕様を策定しのちに拡張していく通常の標準化方法が適さない特殊な言語である。
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
-
|
|
312
|
-
-
|
|
313
|
-
-
|
|
314
|
-
-
|
|
311
|
+
Markdownに本当に必要な仕様はSecuremarkのクラス化制約のように構文の解釈の一貫性と安定性を保つ仕様、バックトラックを抑制する仕様、拡張を確保する仕様などの抽象的仕様であり拡張すると壊れる拡張不可能な具体的仕様などその場限りの価値しかない。
|
|
312
|
+
|
|
313
|
+
### CommonMarkの欠陥
|
|
314
|
+
|
|
315
|
+
- 構文解析戦略の選択の失敗と最小計算量への固執
|
|
316
|
+
- 拡張性の欠如
|
|
317
|
+
- 文脈依存構文を追加不可能(要解析戦略変更)
|
|
318
|
+
- 構文解析の破綻(文脈依存言語の文脈自由言語としての解析を仕様化したことによる破綻)
|
|
319
|
+
- 二重リンク(`[<a@b>]()`)の生成
|
|
320
|
+
-二重リンク自体は回避可能で杜撰なだけだが文脈依存構文として解析できないことが根本原因
|
|
321
|
+
- 画像のalt(`![*a*]()`, `![![a]()`)をMarkdownとして解釈
|
|
322
|
+
- 再帰的バックトラック回避の必要上修正不可能
|
|
323
|
+
- リンクのURLを効率的に解析不可能
|
|
324
|
+
- altはまだしもURLは文脈依存構文としての解析を避けられないため再帰もまた避けられず公式デモページのCommonMarkで`[](`を1万文字程度繰り返しただけで解析時間が1秒を超える
|
|
325
|
+
- この欠陥は入れ子数を制限することで回避可能だがこれはCommonmarkは文脈依存構文全般に入れ子数制限を要することを意味する
|
|
326
|
+
- CommonMarkは最初のバージョンから数年後にこの欠陥を入れ子数制限により修正しこれにより最悪計算量が当初の想定の1nから32nへと32倍に劇的に悪化したことから文脈自由言語および最小計算量としての設計と開発が破綻し失敗に終わったことが明らかである
|
|
327
|
+
- これほど計算量が悪ければ入れ子数制限付き文脈依存言語と大差ない計算量であり素直に文脈依存言語として作り直したほうが遥かに拡張性と発展性が高く優れている
|
|
328
|
+
- 計算資源は使うためにあるにもかかわらず言語と一致しない不適切な解析方法を使用してまでこの程度の計算資源を惜しんで人間に不便と不自由を強いて生産性を下げるのは本末転倒である
|
|
329
|
+
- 計算機は人間の生産性に奉仕しなければならない
|
|
330
|
+
- タブまたは4スペース以上で字下げ不可能(要構文削除)
|
|
331
|
+
- 情報の再利用困難性
|
|
315
332
|
- 引用に恒等性がない
|
|
316
333
|
- 改行に恒等性がない
|
|
317
334
|
|
|
335
|
+
### CommonMarkの解析規則の問題点
|
|
336
|
+
|
|
337
|
+
開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず早く閉じるよう解析しなければならない。このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。従って記号内側の非空白要件以外のflanking要件は不要である。
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
flanking*!?*
|
|
341
|
+
-> flanking*!?*
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
`**`が`*`に分解されるか一貫性がなく直感的使用が困難。
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
**a*b*
|
|
348
|
+
-> **a<em>b</em>
|
|
349
|
+
|
|
350
|
+
***a*b*c*
|
|
351
|
+
-> <em><em><em>a</em>b</em>c</em>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
偶奇へ不必要に依存し偶数個の`*`がすべて`<strong>`に解析されるため`<em>`が含まれるか目視で判別不能。
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
******a******
|
|
358
|
+
-> <strong><strong><strong>a</strong></strong></strong>
|
|
359
|
+
```
|
|
360
|
+
|
|
318
361
|
### トランスクルージョン
|
|
319
362
|
|
|
320
363
|
分散的に管理される情報のトランスクルージョンは権利関係の不明瞭さおよびリンク先の消失によりリンク元の情報に欠損が生じるなどの脆さから壊れやすいウェブ上の情報を扱う方法として既存の方法より劣っておりWikipediaのように中央集権的管理を実施できる場合にのみ有用となる。
|
|
@@ -332,4 +375,4 @@ Data URIは保存および転送容量削減ならびにユーザーおよび管
|
|
|
332
375
|
|
|
333
376
|
### _ emphasis
|
|
334
377
|
|
|
335
|
-
|
|
378
|
+
外側非空白要件なしでは非分かち書き言語で使用できず非空白要件ありではオートリンクと単語検索と致命的に相性が悪いため不採用。
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.286.
|
|
1
|
+
/*! securemark v0.286.3 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -507,7 +507,7 @@ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combin
|
|
|
507
507
|
const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
|
|
508
508
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず早く閉じるよう解析しなければならない。
|
|
509
509
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
510
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
510
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***', (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
|
|
511
511
|
switch (cs[0]) {
|
|
512
512
|
case '***':
|
|
513
513
|
return [bs, rest];
|
|
@@ -552,7 +552,7 @@ nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nod
|
|
|
552
552
|
rest = rest.slice(postfix);
|
|
553
553
|
}
|
|
554
554
|
return [nodes, rest];
|
|
555
|
-
}))))
|
|
555
|
+
}))));
|
|
556
556
|
|
|
557
557
|
/***/ },
|
|
558
558
|
|
|
@@ -1521,7 +1521,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
1521
1521
|
const visibility_1 = __webpack_require__(6364);
|
|
1522
1522
|
const array_1 = __webpack_require__(6876);
|
|
1523
1523
|
const dom_1 = __webpack_require__(394);
|
|
1524
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
1524
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))]))))), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
1525
1525
|
|
|
1526
1526
|
/***/ },
|
|
1527
1527
|
|
|
@@ -2002,7 +2002,7 @@ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://'
|
|
|
2002
2002
|
exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.focus)(/^!?https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))), ({
|
|
2003
2003
|
source
|
|
2004
2004
|
}) => [[source], '']])]))));
|
|
2005
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
2005
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 0 /* Backtrack.url */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 0 /* Backtrack.url */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 0 /* Backtrack.url */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 0 /* Backtrack.url */)]));
|
|
2006
2006
|
|
|
2007
2007
|
/***/ },
|
|
2008
2008
|
|
|
@@ -2076,7 +2076,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
2076
2076
|
const dom_1 = __webpack_require__(394);
|
|
2077
2077
|
const body = (0, source_1.str)(/^\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/);
|
|
2078
2078
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
|
|
2079
|
-
exports.label = (0, combinator_1.constraint)(16 /* State.label */, false, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, 1 |
|
|
2079
|
+
exports.label = (0, combinator_1.constraint)(16 /* State.label */, false, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, 1 | 4 /* Backtrack.bracket */), body]), ([text]) => [(0, dom_1.html)('a', {
|
|
2080
2080
|
class: 'label',
|
|
2081
2081
|
'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
|
|
2082
2082
|
}, text)]));
|
|
@@ -2466,7 +2466,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
|
|
|
2466
2466
|
'data-invalid-type': 'content',
|
|
2467
2467
|
'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
|
|
2468
2468
|
}, source)], ''])));
|
|
2469
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
2469
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^[{}$\n]/)]))), (0, source_1.str)('}'), true));
|
|
2470
2470
|
|
|
2471
2471
|
/***/ },
|
|
2472
2472
|
|
|
@@ -3274,7 +3274,7 @@ const optspec = {
|
|
|
3274
3274
|
rel: ['nofollow']
|
|
3275
3275
|
};
|
|
3276
3276
|
Object.setPrototypeOf(optspec, null);
|
|
3277
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, 1 |
|
|
3277
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, 1 | 8 /* Backtrack.linebracket */, 4 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 | 20 /* Backtrack.link */))])), ([params, content = []], rest, context) => {
|
|
3278
3278
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
3279
3279
|
return [[parse((0, dom_1.defrag)(content), params, context)], rest];
|
|
3280
3280
|
}))))));
|
|
@@ -3973,9 +3973,10 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
3973
3973
|
const util_1 = __webpack_require__(4992);
|
|
3974
3974
|
const array_1 = __webpack_require__(6876);
|
|
3975
3975
|
const dom_1 = __webpack_require__(394);
|
|
3976
|
+
// 可読性のため実際にはオブリーク体を指定する。
|
|
3976
3977
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
3977
3978
|
// ある程度の長さのある文に使うのが望ましい。
|
|
3978
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
3979
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///', (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), exports.italic)])))), '///', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), nodes => [(0, dom_1.html)('i', (0, dom_1.defrag)(nodes))]))));
|
|
3979
3980
|
|
|
3980
3981
|
/***/ },
|
|
3981
3982
|
|
|
@@ -4321,6 +4322,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4321
4322
|
exports.str = void 0;
|
|
4322
4323
|
const combinator_1 = __webpack_require__(3484);
|
|
4323
4324
|
function str(pattern, not) {
|
|
4325
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
4324
4326
|
return typeof pattern === 'string' ? ({
|
|
4325
4327
|
source
|
|
4326
4328
|
}) => {
|
|
@@ -4333,7 +4335,7 @@ function str(pattern, not) {
|
|
|
4333
4335
|
}) => {
|
|
4334
4336
|
if (source === '') return;
|
|
4335
4337
|
const m = source.match(pattern);
|
|
4336
|
-
m && (0, combinator_1.consume)(m[0].length, context);
|
|
4338
|
+
count && m && (0, combinator_1.consume)(m[0].length, context);
|
|
4337
4339
|
if (m && not && source.slice(m[0].length, m[0].length + not.length) === not) return;
|
|
4338
4340
|
return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : undefined;
|
|
4339
4341
|
};
|
|
@@ -4358,7 +4360,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
4358
4360
|
const dom_1 = __webpack_require__(394);
|
|
4359
4361
|
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [['\n', 9], [')', 1]])))), '))', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', {
|
|
4360
4362
|
class: 'annotation'
|
|
4361
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 |
|
|
4363
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 | 8 /* Backtrack.linebracket */, 4 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
|
|
4362
4364
|
|
|
4363
4365
|
/***/ },
|
|
4364
4366
|
|
|
@@ -5027,8 +5029,8 @@ const source_1 = __webpack_require__(8745);
|
|
|
5027
5029
|
const dom_1 = __webpack_require__(394);
|
|
5028
5030
|
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.union)([bracket, source_1.escsource]), ns => ns[0] !== "\u001B" /* Command.Escape */), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
|
|
5029
5031
|
class: 'template'
|
|
5030
|
-
}, `{{${ns.join('')}}}`)], rest], undefined, 3 |
|
|
5031
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
5032
|
+
}, `{{${ns.join('')}}}`)], rest], undefined, 3 | 28 /* Backtrack.template */));
|
|
5033
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /^["\n]/))), (0, source_1.str)('"'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 28 /* Backtrack.template */)]));
|
|
5032
5034
|
|
|
5033
5035
|
/***/ },
|
|
5034
5036
|
|
|
@@ -5048,7 +5050,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5048
5050
|
const util_1 = __webpack_require__(4992);
|
|
5049
5051
|
const array_1 = __webpack_require__(6876);
|
|
5050
5052
|
const dom_1 = __webpack_require__(394);
|
|
5051
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
5053
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.insertion, '+'), true)]))), '++', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), nodes => [(0, dom_1.html)('ins', (0, dom_1.defrag)(nodes))]))));
|
|
5052
5054
|
|
|
5053
5055
|
/***/ },
|
|
5054
5056
|
|
|
@@ -5069,11 +5071,11 @@ const array_1 = __webpack_require__(6876);
|
|
|
5069
5071
|
const dom_1 = __webpack_require__(394);
|
|
5070
5072
|
const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*(?=\))/;
|
|
5071
5073
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)|\)(?=\)$)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
5072
|
-
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, source_1.str)(indexA))), (0, source_1.str)(')'), false, undefined, undefined, 3 |
|
|
5074
|
+
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, source_1.str)(indexA))), (0, source_1.str)(')'), false, undefined, undefined, 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
5073
5075
|
class: 'paren'
|
|
5074
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 |
|
|
5076
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, source_1.str)(indexF))), (0, source_1.str)(')'), false, undefined, undefined, 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
5075
5077
|
class: 'paren'
|
|
5076
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 |
|
|
5078
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
|
|
5077
5079
|
// 改行禁止はバックトラックなしでは内側の構文を破壊するため安易に行えない。
|
|
5078
5080
|
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '"', [['\n', 9], ['"', 2]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('“'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '”', [['\n', 9], ['”', 2]]))), (0, source_1.str)('”'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('‘'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '’', [['\n', 9], ['’', 2]]))), (0, source_1.str)('’'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('「'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '」', [['\n', 9], ['」', 2]]))), (0, source_1.str)('」'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('『'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '』', [['\n', 9], ['』', 2]]))), (0, source_1.str)('』'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
|
|
5079
5081
|
|
|
@@ -5157,7 +5159,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5157
5159
|
const dom_1 = __webpack_require__(394);
|
|
5158
5160
|
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [['\n', 9], [']', 1]])))), ']', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('a', {
|
|
5159
5161
|
'data-index': dataindex(ns)
|
|
5160
|
-
}, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, 1 |
|
|
5162
|
+
}, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, 1 | 8 /* Backtrack.linebracket */, 4 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), ([el]) => [(0, dom_1.define)(el, {
|
|
5161
5163
|
id: el.id ? null : undefined,
|
|
5162
5164
|
class: 'index',
|
|
5163
5165
|
href: el.id ? `#${el.id}` : undefined
|
|
@@ -5166,7 +5168,7 @@ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|',
|
|
|
5166
5168
|
class: 'indexer',
|
|
5167
5169
|
'data-index': (0, indexee_1.identity)('index', undefined, ns.join('')).slice(7)
|
|
5168
5170
|
})])));
|
|
5169
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
5171
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ')')), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 24 /* Backtrack.index */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']')), (0, source_1.str)(']'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 24 /* Backtrack.index */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), '}')), (0, source_1.str)('}'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 24 /* Backtrack.index */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.txt, '"'))), (0, source_1.str)('"'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 24 /* Backtrack.index */)]));
|
|
5170
5172
|
function dataindex(ns) {
|
|
5171
5173
|
if (ns.length === 0) return;
|
|
5172
5174
|
for (let i = ns.length - 1; i >= 0; --i) {
|
|
@@ -5410,9 +5412,9 @@ const attrspecs = {
|
|
|
5410
5412
|
};
|
|
5411
5413
|
Object.setPrototypeOf(attrspecs, null);
|
|
5412
5414
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
5413
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.
|
|
5415
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)(
|
|
5414
5416
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
5415
|
-
(0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.precedence)(3, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 3]]), true))])), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new Map())), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/i, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.precedence)(3, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 3]])])), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new clock_1.Clock(10000)))])))
|
|
5417
|
+
(0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 3]]), true))]))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new Map())), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/i, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 3]])]))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new clock_1.Clock(10000)))])));
|
|
5416
5418
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="[^"\n]*")?(?=[^\S\n]|>)/i)]);
|
|
5417
5419
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
5418
5420
|
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
@@ -5494,7 +5496,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5494
5496
|
const util_1 = __webpack_require__(4992);
|
|
5495
5497
|
const array_1 = __webpack_require__(6876);
|
|
5496
5498
|
const dom_1 = __webpack_require__(394);
|
|
5497
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(
|
|
5499
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, false, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)])))), '==', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), (nodes, {
|
|
5498
5500
|
id
|
|
5499
5501
|
}) => {
|
|
5500
5502
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
|
|
@@ -5545,9 +5547,9 @@ exports.isAlphanumeric = exports.linebreak = exports.txt = exports.text = export
|
|
|
5545
5547
|
const combinator_1 = __webpack_require__(3484);
|
|
5546
5548
|
const str_1 = __webpack_require__(4017);
|
|
5547
5549
|
const dom_1 = __webpack_require__(394);
|
|
5548
|
-
exports.delimiter = /[\s\x00-\x7F()[]{}“”‘’「」『』]|\S[
|
|
5550
|
+
exports.delimiter = /[\s\x00-\x7F()[]{}“”‘’「」『』]|\S#|[0-9A-Za-z]>/u;
|
|
5549
5551
|
exports.nonWhitespace = /[\S\n]|$/u;
|
|
5550
|
-
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[
|
|
5552
|
+
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S#|[0-9A-Za-z]>|$/u;
|
|
5551
5553
|
const repeat = (0, str_1.str)(/^(.)\1*/);
|
|
5552
5554
|
const text = ({
|
|
5553
5555
|
source,
|
|
@@ -5922,7 +5924,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
5922
5924
|
// https://example/hashtags/a must be a hashtag page or a redirect page going there.
|
|
5923
5925
|
// https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
|
|
5924
5926
|
exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
|
|
5925
|
-
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?!['_])(?=(?:[0-9]{1,9})?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'|_(?=[
|
|
5927
|
+
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?!['_])(?=(?:[0-9]{1,9})?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji)))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+/u.source].join('').replace(/emoji/g, exports.emoji), 'u'))), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink), ([el]) => [(0, dom_1.define)(el, {
|
|
5926
5928
|
class: 'hashtag'
|
|
5927
5929
|
})]))), ({
|
|
5928
5930
|
source
|
|
@@ -6207,12 +6209,12 @@ const array_1 = __webpack_require__(6876);
|
|
|
6207
6209
|
const dom_1 = __webpack_require__(394);
|
|
6208
6210
|
// Don't use the symbols already used: !#$%@&*+~=|
|
|
6209
6211
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
6210
|
-
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6212
|
+
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/^\[[:^|]/), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, ([, bs], rest) => [[(0, dom_1.html)('span', {
|
|
6211
6213
|
class: 'invalid',
|
|
6212
6214
|
'data-invalid-syntax': 'extension',
|
|
6213
6215
|
'data-invalid-type': 'syntax',
|
|
6214
6216
|
'data-invalid-message': `Invalid start symbol or linebreak`
|
|
6215
|
-
}, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest], 3 |
|
|
6217
|
+
}, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 4 /* Backtrack.bracket */));
|
|
6216
6218
|
|
|
6217
6219
|
/***/ },
|
|
6218
6220
|
|
|
@@ -6573,7 +6575,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6573
6575
|
const visibility_1 = __webpack_require__(6364);
|
|
6574
6576
|
const array_1 = __webpack_require__(6876);
|
|
6575
6577
|
const dom_1 = __webpack_require__(394);
|
|
6576
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6578
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', '*'), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))]))))), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6577
6579
|
|
|
6578
6580
|
/***/ },
|
|
6579
6581
|
|
|
@@ -6955,7 +6957,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
6955
6957
|
const util_1 = __webpack_require__(4992);
|
|
6956
6958
|
const array_1 = __webpack_require__(6876);
|
|
6957
6959
|
const dom_1 = __webpack_require__(394);
|
|
6958
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6960
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.deletion, '~'), true)]))), '~~', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), nodes => [(0, dom_1.html)('del', (0, dom_1.defrag)(nodes))]))));
|
|
6959
6961
|
|
|
6960
6962
|
/***/ },
|
|
6961
6963
|
|
|
@@ -7149,20 +7151,20 @@ const source_1 = __webpack_require__(8745);
|
|
|
7149
7151
|
const visibility_1 = __webpack_require__(6364);
|
|
7150
7152
|
const array_1 = __webpack_require__(6876);
|
|
7151
7153
|
const dom_1 = __webpack_require__(394);
|
|
7152
|
-
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.sequence)([(0, combinator_1.
|
|
7154
|
+
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/u), ']', false, ([, [source]], rest, context) => {
|
|
7153
7155
|
const ns = (0, parser_1.eval)(text({
|
|
7154
7156
|
source,
|
|
7155
7157
|
context
|
|
7156
7158
|
}), [undefined])[0];
|
|
7157
7159
|
ns && ns.at(-1) === '' && ns.pop();
|
|
7158
|
-
return ns && (0, visibility_1.isTightNodeStart)(ns) ? [
|
|
7159
|
-
}), (0, combinator_1.
|
|
7160
|
+
return ns && (0, visibility_1.isTightNodeStart)(ns) ? [ns, rest] : undefined;
|
|
7161
|
+
}, undefined, 3 | 16 /* Backtrack.ruby */)), (0, combinator_1.dup)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/u), ')', false, ([, [source]], rest, context) => {
|
|
7160
7162
|
const ns = (0, parser_1.eval)(text({
|
|
7161
7163
|
source,
|
|
7162
7164
|
context
|
|
7163
7165
|
}), [undefined])[0];
|
|
7164
|
-
return ns && [
|
|
7165
|
-
})]), ([texts, rubies]) => {
|
|
7166
|
+
return ns && [ns, rest];
|
|
7167
|
+
}, undefined, 3 | 16 /* Backtrack.ruby */))]), ([texts, rubies]) => {
|
|
7166
7168
|
switch (true) {
|
|
7167
7169
|
case rubies.length <= texts.length:
|
|
7168
7170
|
return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))];
|
|
@@ -7310,7 +7312,7 @@ const optspec = {
|
|
|
7310
7312
|
rel: undefined
|
|
7311
7313
|
};
|
|
7312
7314
|
Object.setPrototypeOf(optspec, null);
|
|
7313
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ns => ns[0] !== "\u001B" /* Command.Escape */), ']', [['\n', 9]])), ']', true, undefined, undefined, 1 |
|
|
7315
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ns => ns[0] !== "\u001B" /* Command.Escape */), ']', [['\n', 9]])), ']', true, undefined, undefined, 1 | 12 /* Backtrack.media */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 | 20 /* Backtrack.link */))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
7314
7316
|
const INSECURE_URI = params.shift();
|
|
7315
7317
|
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
7316
7318
|
let cache;
|
|
@@ -7337,7 +7339,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7337
7339
|
});
|
|
7338
7340
|
}))))));
|
|
7339
7341
|
exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
7340
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 |
|
|
7342
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 12 /* Backtrack.media */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 12 /* Backtrack.media */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 12 /* Backtrack.media */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [["\u001B" /* Command.Escape */], ''], 3 | 12 /* Backtrack.media */)])));
|
|
7341
7343
|
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]));
|
|
7342
7344
|
function sanitize(target, uri, alt) {
|
|
7343
7345
|
switch (uri.protocol) {
|
|
@@ -8152,15 +8154,15 @@ const hashnum_1 = __webpack_require__(8684);
|
|
|
8152
8154
|
const anchor_1 = __webpack_require__(8535);
|
|
8153
8155
|
const source_1 = __webpack_require__(8745);
|
|
8154
8156
|
const util_1 = __webpack_require__(4992);
|
|
8155
|
-
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^(?:[@#>0-9a-z]|\S[
|
|
8157
|
+
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^(?:[@#>0-9a-z]|\S#|[0-9a-z]>|[\r\n]!?https?:\/\/)/iu, (0, combinator_1.state)(~1 /* State.autolink */, (0, combinator_1.union)([(0, combinator_1.some)((0, combinator_1.union)([url_1.lineurl])), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email,
|
|
8156
8158
|
// Escape unmatched email-like strings.
|
|
8157
|
-
(0, source_1.str)(/^[0-9a-z]+(?:[_.+-][0-9a-z]
|
|
8159
|
+
(0, source_1.str)(/^[0-9a-z]+(?:[_.+-][0-9a-z]+|@(?=@))*/i), channel_1.channel, account_1.account,
|
|
8158
8160
|
// Escape unmatched account-like strings.
|
|
8159
|
-
(0, source_1.str)(/^@+[0-9a-z]
|
|
8161
|
+
(0, source_1.str)(/^@+(?:[0-9a-z]+(?:[_.+-][0-9a-z]+)*)?/i),
|
|
8160
8162
|
// Escape invalid leading characters.
|
|
8161
|
-
(0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji
|
|
8163
|
+
(0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji)(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum,
|
|
8162
8164
|
// Escape unmatched hashtag-like strings.
|
|
8163
|
-
(0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji
|
|
8165
|
+
(0, source_1.str)(new RegExp(/^#+(?:(?:[^\p{C}\p{S}\p{P}\s]|emoji)+(?:['_.+-](?:[^\p{C}\p{S}\p{P}\s]|emoji)+)*)?/u.source.replace(/emoji/g, hashtag_1.emoji), 'u')),
|
|
8164
8166
|
// Escape invalid leading characters.
|
|
8165
8167
|
(0, source_1.str)(/^[0-9a-z](?=>)/iu), anchor_1.anchor])), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)])]))));
|
|
8166
8168
|
|
|
@@ -8678,7 +8680,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
8678
8680
|
const hashtag_1 = __webpack_require__(5764);
|
|
8679
8681
|
const source_1 = __webpack_require__(8745);
|
|
8680
8682
|
const dom_1 = __webpack_require__(394);
|
|
8681
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,9}(?![^\p{C}\p{S}\p{P}\s]|emoji
|
|
8683
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,9}(?![^\p{C}\p{S}\p{P}\s]|emoji)/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, link_1.unsafelink), ([el]) => [(0, dom_1.define)(el, {
|
|
8682
8684
|
class: 'hashnum',
|
|
8683
8685
|
href: null
|
|
8684
8686
|
})]))), ({
|
|
@@ -8879,11 +8881,11 @@ const source_1 = __webpack_require__(8745);
|
|
|
8879
8881
|
const memoize_1 = __webpack_require__(6925);
|
|
8880
8882
|
const array_1 = __webpack_require__(6876);
|
|
8881
8883
|
const dom_1 = __webpack_require__(394);
|
|
8882
|
-
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
8884
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, source_1.str)(`[${fence}`), (0, combinator_1.precedence)(4, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]))), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, '%'), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
8883
8885
|
class: 'remark'
|
|
8884
8886
|
}, [(0, dom_1.html)('input', {
|
|
8885
8887
|
type: 'checkbox'
|
|
8886
|
-
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, {})))
|
|
8888
|
+
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, {})));
|
|
8887
8889
|
|
|
8888
8890
|
/***/ },
|
|
8889
8891
|
|
|
@@ -8902,7 +8904,10 @@ const inline_1 = __webpack_require__(7973);
|
|
|
8902
8904
|
const source_1 = __webpack_require__(8745);
|
|
8903
8905
|
const visibility_1 = __webpack_require__(6364);
|
|
8904
8906
|
const dom_1 = __webpack_require__(394);
|
|
8905
|
-
|
|
8907
|
+
const array_1 = __webpack_require__(6876);
|
|
8908
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.surround)('[[', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [['\n', 9], [']', 1]]))]))), ']]', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, ([as, bs], rest, {
|
|
8909
|
+
state = 0
|
|
8910
|
+
}) => state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs), rest] : undefined, 1 | 8 /* Backtrack.linebracket */, 4 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
|
|
8906
8911
|
// Chicago-Style
|
|
8907
8912
|
const abbr = (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|[^\S\n]*/, true, ([, ns], rest) => ns ? [['\n', ns[0].trimEnd()], rest.replace(visibility_1.blank.start, '')] : [[''], `^${rest}`], ([,, rest]) => [[''], `^${rest}`]);
|
|
8908
8913
|
function attributes(ns) {
|
package/markdown.d.ts
CHANGED