Skip to main content

Channel

Enum Channel 

Source
pub enum Channel {
    TelegramHtml,
    SlackMarkdown,
    GithubMarkdown,
    NotionMarkdown,
    Plain,
    Html,
}
Expand description

내보낼 채널. 받는 문법이 채널마다 다르고, 출력이 좁은 쪽이 파싱 범위를 정한다.

Variants§

§

TelegramHtml

Telegram parse_mode=HTML. 허용 태그 9개: b i u s code pre a blockquote tg-spoiler. 표·헤딩 없음. 4096자.

§

SlackMarkdown

Slack markdown_text. 표준 마크다운을 슬랙이 직접 변환한다. 12,000자. 변환이 거의 필요 없고, 남는 일은 정규화와 분할뿐이다.

§

GithubMarkdown

GitHub 코멘트·PR 본문(GFM). 표·헤딩·취소선을 다 그린다. 65,536자. 슬랙과 같은 마크다운을 내되, GFM 이 구문으로 읽는 글자 둘(~ <)을 탈출한다.

§

NotionMarkdown

노션 페이지 본문(Notion-flavored Markdown — API markdown 필드·커넥터). 헤딩은 네 단계. GitHub 과 같은 마크다운을 내되, 노션이 못 그리는 인라인 HTML 은 벗기고(글자로 보인다), 오토링크 <url> 은 [url](url) 로 쓴다(꺾쇠가 글자로 남는다). 조사 앞 강조는 노션이 그대로 그려서 <strong> 으로 바꾸지 않는다 — 바꾸면 오히려 태그가 글자로 보인다.

§

Plain

모든 마크업 제거. 폴백 경로.

§

Html

브라우저에 넣을 HTML 조각. 헤딩·목록·표·코드블록을 태그로 그린다. 한도 없음.

innerHTML 로 바로 넣는 것을 전제로 한다 — 글자는 전부 escape 하고, 원문의 HTML 은 속성을 버린 인라인 태그만 살리며, 링크는 http(s)·mailto 만 <a> 로 낸다. 스트리밍 누적본에 Streamer::close_open 을 붙이면 그대로 넣어도 되는 모양이 된다.

Implementations§

Source§

impl Channel

Source

pub fn name(self) -> &'static str

코퍼스 디렉토리와 CLI 인자에서 쓰는 이름. 채널을 문자열로 다루는 곳의 정본이다.

Source

pub fn all() -> [Channel; 6]

내보낼 수 있는 채널 전부. 코퍼스와 하네스가 이 목록을 돈다.

Source

pub fn parse(name: &str) -> Option<Channel>

이름으로 채널을 찾는다.

Source

pub fn limit(self) -> usize

이 채널의 메시지 길이 한도(문자 수). 분할의 기준이다.

Trait Implementations§

Source§

impl Clone for Channel

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Channel

Source§

impl Debug for Channel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Channel

Source§

impl PartialEq for Channel

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Channel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.