Skip to content

Latest commit

 

History

History
475 lines (358 loc) · 12.6 KB

helpers.md

File metadata and controls

475 lines (358 loc) · 12.6 KB

Functions

asset_url(slug, [post])string

asset URL 가져옴
asset이 _posts에 있는 경우, post asset으로부터 URL을 가져옴. 그렇지 않으면 source로부터 URL을 가져옴.

compile_sass(css)string

포스트(페이지)별 SA(C)SS 컴파일

full_url(url)string | void

상대/절대 URL로부터 전체 URL 가져옴
개발 모드에서는 시연을 위해 주어진 URL을 그대로 유지 함

generate_uid()string

i49ygg04c64 같이 소문자와 숫자로 구성 된 고유 ID 생성

archive_array(year)array

아카이브 게시글 목록 가져옴

archive_map()yearlyPosts

연도 및 월로 매핑 된 아카이브 데이터를 가져옴

icon_info(icon)IconInfo

fontawesome으로부터 아이콘의 이름과 카테고리를 가져옴

kor_josa(word, postposition)string

한국어 단어에 대해 적절한 조사 생성

list_categories(categories, options)string

모든 카테고리 목록 삽입
Hexo의 listCategoriesHelper 헬퍼에서 염감을 받았습니다

list_links(links, options)string

외부 링크 목록 삽입
Hexo의 listCategoriesHelper 헬퍼에서 염감을 받았습니다

list_menus(menus, options)string

메뉴 목록 삽입
Hexo의 listCategoriesHelper 헬퍼에서 염감을 받았습니다

open_graph(options)string

OpenGraph 데이터 삽입
hexo의 openGraphHelper에서 영감을 받았습니다.
이미지 항목에 테마 및 페이지의 hero 설정이 추가되었습니다.

paginator(options)string

페이지네이션 삽입
hexo panigator 헬퍼에서 영감을 받았습니다. 좀 더 접근 가능하도록 개선되었습니다.

representative_image(page)ImageProbe

대표 이미지 객체를 가져옴

strip_html(str)string

문자열에서 HTML 태그 제거
highlightJS가 생성한 라인 표시기 및 특수 문자 변환 추가가 hexo 것과의 차이입니다.

truncate(str, len)string

글자가 잘려서 문장을 이해하기 어려워지지 않도록 단어별로 잘라 냄

Typedefs

archivePost : object

아카이브에 대한 게시글 데이터 객체

monthlyPosts : Map.<number, Array.<archivePost>>
yearlyPosts : Map.<number, monthlyPosts>
IconInfo : object
ImageProbe : Object | null

asset_url(slug, [post]) ⇒ string

asset URL 가져옴
asset이 _posts에 있는 경우, post asset으로부터 URL을 가져옴. 그렇지 않으면 source로부터 URL을 가져옴.

Kind: global function
Access: public

매개변수 유형 설명
slug string asset의 slug
[post] object Hexo post 데이터

*예제"

asset_url(post.thumbnail, post)

compile_sass(css) ⇒ string

포스트(페이지)별 SA(C)SS 컴파일

Kind: global function
Access: public

매개변수 유형 설명
css string 처리할 SA(C)SS

*예제"

if page.style
  style
    != compile_sass(page.style)

full_url(url) ⇒ string | void

상대/절대 URL로부터 전체 URL 가져옴
개발 모드에서는 시연을 위해 주어진 URL을 그대로 유지 함

Kind: global function
Access: public

매개변수 유형
url string

*예제"

a(href= full_url(`/search`)

generate_uid() ⇒ string

i49ygg04c64과 같이 소문자 및 숫자로 구성 된 고유 ID 생성

Kind: global function
Access: public
*예제"

a(id= generate_uid())

archive_array(year) ⇒ array

아카이브 게시글 목록 가져옴

Kind: global function
Returns: array - array of posts
Access: public

매개변수 유형 설명
year number 아카이브 연도.
연도가 지정 된되는 경우, 연도에 대한 모든 게시글을 반환합니다. 그렇지 않으면, 마지막 MAX_YEAR_LEN년까지 게시글을 반환합니다.

*예제"

- const archiveItems = getArchivePostsArray();
- const archiveItems = getArchivePostsArray(2023);

archive_map() ⇒ yearlyPosts

연도 및 월로 매핑 된 아카이브 데이터를 가져옴

Kind: global function
Access: public
*예제"

+archiveTimeline({
  archives: archive_map(),
  headingLevel: 2,
})

icon_info(icon) ⇒ IconInfo

fontawesome으로부터 아이콘의 이름과 카테고리를 가져옴

Kind: global function
Access: public

매개변수 유형 설명
icon string 아이콘 이름, 아이콘 카테고리를 슬래시와 슬래시 뒤의 문자로 미리 정의하는 것도 가능합니다

*예제"

- const { iconName, iconCategory } = icon_info("bell")
- const { iconName, iconCategory } = icon_info("bell/regular")

kor_josa(word, postposition) ⇒ string

한국어 단어에 대해 적절한 조사 생성

Kind: global function
Access: public

매개변수 유형 설명
word string 조사를 붙이기 원하는 단어
postposition string 조사 종류 (은/는, 이/가, 을/를)

*예제"

p= title + kor_josa(title, "")
p= title + kor_josa(title, "")
p= title + kor_josa(title, "")
p= title + kor_josa(title, "")
p= title + kor_josa(title, "")
p= title + kor_josa(title, "")

list_categories(categories, options) ⇒ string

모든 카테고리 목록 삽입 Hexo의 listCategoriesHelper 헬퍼에서 염감을 받았습니다

Kind: global function
Access: public

매개변수 유형 설명
categories object Hexo의 이터러블 카테고리 객체
options object https://hexo.io/docs/helpers#list-categories 참고

*예제"

div
 | !{list_categories({})}

list_links(links, options) ⇒ string

외부 링크 목록 삽입
Hexo의 listCategoriesHelper 헬퍼에서 염감을 받았습니다

Kind: global function
Access: public

매개변수 유형 설명
links Array.<{name: string, url: string}> name과 url로 구성된 객체 배열
options object 설정 객체
options.transform function 링크 이름 표현을 변경하는 함수
options.class string 링크 목록의 클래스 이름

*예제"

div
 | !{list_links({})}

list_menus(menus, options) ⇒ string

메뉴 목록 삽입 Hexo의 listCategoriesHelper 헬퍼에서 염감을 받았습니다

Kind: global function
Access: public

매개변수 유형 설명
menus Array.<object> 테마 설정의 메뉴
options object 설정 객체
options.transform function 메뉴 이름 표현을 변경하는 함수
options.class string 메뉴 목록의 클래스 이름

*예제"

div
 | !{list_menus({})}

open_graph(options) ⇒ string

OpenGraph 데이터 삽입 hexo의 openGraphHelper에서 영감을 받았습니다.
이미지 항목에 테마 및 페이지의 hero 설정이 추가되었습니다.

Kind: global function
Access: public

매개변수 유형 설명
options object https://hexo.io/docs/helpers#open-graph 참고

*예제"

| !{ open_graph() }

paginator(options) ⇒ string

페이지네이션 삽입
hexo panigator 헬퍼에서 영감을 받았습니다. 좀 더 접근 가능하도록 개선되었습니다.

Kind: global function
Access: public

매개변수 유형 설명
options object https://hexo.io/docs/helpers#paginator 참고

*예제"

| !{ paginator({ base: `/` }) }

representative_image(page) ⇒ ImageProbe

대표 이미지 객체를 가져옴

Kind: global function
Access: public

매개변수 유형 설명
page object hexo의 page 객체

*예제"

- const hero = representative_image(theme);

strip_html(str) ⇒ string

문자열에서 HTML 태그 제거
highlightJS가 생성한 라인 표시기 및 특수 문자 변환 추가가 hexo 것과의 차이입니다.

Kind: global function
Access: public

매개변수 유형 설명
str string 본래 문자열

*예제"

p= strip_html(post.content)

truncate(str, len) ⇒ string

글자가 잘려서 문장을 이해하기 어려워지지 않도록 단어별로 잘라 냄

Kind: global function
Access: public

매개변수 유형
str string
len number

archivePost : object

아키이브에 대한 게시글 데이터 객체

Kind: global typedef
프로퍼티

이름 유형
title string
subtitle string
permalink string
date Moment
categories SchemaTypeArray

monthlyPosts : Map.<number, Array.<archivePost>>

Kind: global typedef


yearlyPosts : Map.<number, monthlyPosts>

Kind: global typedef


IconInfo : object

Kind: global typedef
프로퍼티

이름 유형
iconName string
iconCategory string

ImageProbe : Object | null

Kind: global typedef 프로퍼티

이름 유형 설명
path string
width number
height number
type string 이미지 유형, 일반적으로 파일 이름 확장자
mime string
wUnits string
hUnits string