~/bend-docscommunity

protect.bend checks

raw source on the hub · import 0x3db8fc3ab5ba012b34ead11a441dd57c/protect.bend as Protect

Markdown protect regions — port of bible-linkify protect.ts (pure Bend) Length of protected span at suffix start, or 0n. Phase-carried Bools only.

1 import
import Base

Types

type FmPh source · line 57 · raw

Data

--- Frontmatter --- Port of protect.ts findFrontmatter: open "---\n" / "---\r\n", close earliest of "\n---\n" | "\n---\r\n" | "\n---".

type FsPh source · line 270 · raw

Data

--- Fence ---

type FnGate source · line 467 · raw

Data

type IcPh source · line 508 · raw

Data

--- Inline code ---

type IcGate source · line 595 · raw

Data

type WkPh source · line 615 · raw

Data

--- Wikilink ---

type WkGate source · line 682 · raw

Data

type MdPh source · line 698 · raw

Data

--- Markdown link ---

type MdGate source · line 799 · raw

Data

type HtPh source · line 856 · raw

Data

--- HTML ---

type PkPh source · line 953 · raw

Data

--- Priority pick ---

type FpGate source · line 1008 · raw

Data

Definitions

def char1 source · line 5 · raw

@+c:Char -> String

def str_drop_go source · line 8 · raw

@fuel:Nat -> @n:Nat -> @s:String -> String

def str_drop source · line 23 · raw

@+n:Nat -> @+s:String -> String

def str_take_go source · line 26 · raw

@fuel:Nat -> @n:Nat -> @s:String -> @acc:String -> String

def str_take source · line 41 · raw

@+n:Nat -> @+s:String -> String

def is_newline source · line 44 · raw

@+c:Char -> Bool

def is_hyphen source · line 49 · raw

@+c:Char -> Bool

def is_cr source · line 78 · raw

@+c:Char -> Bool

def pick_dash1_nl source · line 83 · raw

@nl:Bool -> FmPh

def pick_dash1 source · line 90 · raw

@is_dash:Bool -> @nl:Bool -> FmPh

def frontmatter_go source · line 97 · raw

@fuel:Nat -> @ph:FmPh -> @+rest:String -> @+consumed:Nat -> Nat

def frontmatter_len_if source · line 254 · raw

@ok:Bool -> @+s:String -> Nat

def frontmatter_len source · line 266 · raw

@+s:String -> Nat

def is_tick_char source · line 282 · raw

@+want_tick:Bool -> @+c:Char -> Bool

def fence_len_go source · line 289 · raw

@fuel:Nat -> @ph:FsPh -> @rest:String -> Nat

def fence_len_from_open source · line 460 · raw

@+want_tick:Bool -> @+s:String -> Nat

def fence_len_gate source · line 473 · raw

@fuel:Nat -> @g:FnGate -> @+s:String -> Nat

def fence_len source · line 500 · raw

@+at_bol:Bool -> @+s:String -> Nat

def inline_code_go source · line 516 · raw

@fuel:Nat -> @ph:IcPh -> @rest:String -> Nat

def inline_code_len_gated source · line 598 · raw

@g:IcGate -> @+s:String -> Nat

def inline_code_len source · line 607 · raw

@+s:String -> Nat

def html_go source · line 866 · raw

@fuel:Nat -> @ph:HtPh -> @rest:String -> Nat

def html_len source · line 949 · raw

@+s:String -> Nat

def protect_len_go source · line 964 · raw

@fuel:Nat -> @ph:PkPh -> @+at_bol:Bool -> @+s:String -> Nat

def protect_len source · line 1005 · raw

@+at_bol:Bool -> @+s:String -> Nat

def pick_nonzero_go source · line 1012 · raw

@+a:Nat -> @+b:Nat -> @z:Bool -> Nat

def pick_nonzero source · line 1019 · raw

@+a:Nat -> @+b:Nat -> Nat

def frontmatter_or_protect source · line 1022 · raw

@+at_doc_start:Bool -> @+at_bol:Bool -> @+s:String -> Nat