Apidoc: 탐색 νŒ¨λ„μ— 머리글 및 λ°”λ‹₯κΈ€μ˜ λΆ€μ œλͺ© ν‘œμ‹œ

에 λ§Œλ“  2015λ…„ 08μ›” 14일  Β·  4μ½”λ©˜νŠΈ  Β·  좜처: apidoc/apidoc

ν˜„μž¬ (ν…œν”Œλ¦Ώμ„ λ³€κ²½ν•  μ˜μ‚¬κ°€ μ—†λŠ” 경우) 정적 μ½˜ν…μΈ λ₯Ό λ§Œλ“œλŠ” μœ μΌν•œ 방법은 λ§ˆν¬λ‹€μš΄ ν˜•μ‹μœΌλ‘œ 머리글과 λ°”λ‹₯κΈ€ νŒŒμΌμ„ μΆ”κ°€ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. μ’‹μ•„μš”. 헀더 νŒŒμΌμ„ μ‚¬μš©ν•˜μ—¬ API에 λŒ€ν•œ (κΈ΄) μ†Œκ°œλ₯Ό μž‘μ„±ν•˜κ³  λ°”λ‹₯글을 μ‚¬μš©ν•˜μ—¬ APIκ°€ λ°˜ν™˜ν•  수 μžˆλŠ” λͺ¨λ“  κ°œμ²΄μ— λŒ€ν•œ μ„€λͺ…을 λ‚˜μ—΄ν•©λ‹ˆλ‹€.

μ—¬κΈ° λ‚΄ κΈ°λŠ₯ μš”μ²­μ΄ μžˆμŠ΅λ‹ˆλ‹€. μ΄λŸ¬ν•œ λ§ˆν¬λ‹€μš΄ 파일의 μžλ§‰μ΄ μ™Όμͺ½ 탐색 νŒ¨λ„μ— λ‚˜μ—΄λ˜λŠ” 것을 λ³΄λŠ” 것은 정말 쒋을 κ²ƒμž…λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄ λ‚΄ λ°”λ‹₯κΈ€ νŒŒμΌμ€ λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.

========

User
----

bla bla bla about user data

Achievement
-----------

bla bla bla about Achievement data

μ™Όμͺ½ νŒ¨λ„μ— "μ‚¬μš©μž"와 "업적"이 링크둜 ν‘œμ‹œλ˜μ–΄ μ‚¬λžŒλ“€μ΄ μ‰½κ²Œ 이동할 수 있고 λ¬Έμ„œμ˜ λ‚˜λ¨Έμ§€ 뢀뢄이 링크λ₯Ό μ°Έμ‘°ν•  수 μžˆλ„λ‘ ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

관심을 κ°€μ Έμ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€. κ³„μ†ν•΄μ„œ 멋진 μž‘μ—…μ„ μ§„ν–‰ν•˜μ„Έμš”!

μ–€

feature request

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

μ’‹μ•„μš”, 정말 ν•„μš”ν•΄μ„œ JSλ₯Ό 쑰금 μΌμŠ΅λ‹ˆλ‹€. 관심 μžˆλŠ” μ‚¬λžŒμ΄ κ³΅μœ ν•˜κ³  μ μš©ν•  수 μžˆμ„ 만큼 κΉ¨λ—ν•©λ‹ˆλ‹€. μ—¬κΈ° κ°„λ‹€.

1) apidoc_nav.jsλΌλŠ” νŒŒμΌμ„ λ§Œλ“€κ³  κ·Έ μ•ˆμ— λ‹€μŒ μ½”λ“œλ₯Ό λ„£μŠ΅λ‹ˆλ‹€.

/**
 * Add navigation items by analyzing the HTML content and searching for h2 tags
 * <strong i="7">@param</strong> nav Object the navigation array
 * <strong i="8">@param</strong> content string the compiled HTML content
 * <strong i="9">@param</strong> index where to insert items: either 1 or nav.length
 */
function add_nav(nav, content, index) {
    if (!content)   return;
    var topics = content.match(/<h2>(.+?)<\/h2>/gi);
    topics.forEach(function(entry) {
        var title = entry.replace(/<.+?>/g, '');    // Remove all HTML tags for the title
        var entry_tags = entry.match(/id="(?:api-)?([^\-]+)-(.+)"/);    // Find the group and name in the id property
        var group = (entry_tags ? entry_tags[1] : null);
        var name = (entry_tags ? entry_tags[2] : null);
        if (title && group && name)    {
            nav.splice(index, 0, {
                group: group,
                name: name,
                isHeader: false,
                title: title,
                isFixed: false,
                version: '1.0'
            });
            index++;
        }
    });
}

/**
 * Add navigation items for the header and the footer
 * <strong i="10">@param</strong> nav Object the navigation array
 * <strong i="11">@param</strong> apiProject Object the apiProject data
 */
function add_header_footer_nav(nav, apiProject)
{
    if (apiProject.header) {
        add_nav(nav, apiProject.header.content, 1);
    }
    if (apiProject.footer && apiProject.footer.title != null) {
        add_nav(nav, apiProject.footer.content, nav.length);
    }
}

2) main.js νŒŒμΌμ—μ„œ 220ν–‰ μ£Όμœ„μ— λ‹€μŒ μ½”λ“œλ₯Ό μ‚½μž…ν•©λ‹ˆλ‹€.

    // Add Header and Footer navigation sub-titles
    add_header_footer_nav(nav, apiProject);

3) index.html νŒŒμΌμ—μ„œ main.js 호좜 직전에 apidoc_nav.jsλ₯Ό ν˜ΈμΆœν•©λ‹ˆλ‹€.

<script src="apidoc_nav.js"></script>  <!-- Add this -->
<script data-main="main.js" src="vendor/require.min.js"></script>

그것은 λ¬΄μ—‡μ„ν•©λ‹ˆκΉŒ? μ½”λ“œλŠ” 머리글 및 λ°”λ‹₯κΈ€ νŒŒμΌμ„ ꡬ문 λΆ„μ„ν•˜κ³  <h2> νƒœκ·Έλ₯Ό κ²€μƒ‰ν•©λ‹ˆλ‹€. api-group-something ν˜•μ‹μ„ λ”°λ₯΄λŠ” μ΄λ¦„μœΌλ‘œ id λ₯Ό μΆ”μΆœν•  수 있으면 탐색 λͺ¨μŒμ— ν•­λͺ©μ΄ μƒμ„±λ©λ‹ˆλ‹€. λ”°λΌμ„œ 레벨 2 제λͺ©μ„ λ§Œλ“€κ³  μ•½κ°„μ˜ HTML을 μ‚¬μš©ν•˜μ—¬ 'd'λ₯Ό λΆ™μ΄κΈ°λ§Œ ν•˜λ©΄ λ©λ‹ˆλ‹€.

예:

μ—¬κΈ°μ„œ ## λ§ˆν¬λ‹€μš΄ νƒœκ·Έ 뒀에 <span> νƒœκ·Έλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€. "κ·Έλ£Ή"은 intro 이고 λ‚˜λ¨Έμ§€λŠ” start-well μž…λ‹ˆλ‹€.

## <span id="api-intro-start-well">Starting Well with APIDoc</span>

레벨 2 타이틀에 λŒ€ν•΄ λŒ€μ²΄ ----- λ§ˆν¬λ‹€μš΄ νƒœκ·Έλ₯Ό μ‚¬μš©ν•˜λŠ” λ™μΌν•œ 예:

<span id="api-intro-start-well">Starting Well with APIDoc</span>
----------------------------------------------------------

id κ°€ api- 둜 μ‹œμž‘ν•˜κ³  λ‹€λ₯Έ 단어(κ·Έλ£Ή), λŒ€μ‹œ 및 이름(λŒ€μ‹œλ₯Ό 포함할 수 있음)을 κ°–λŠ” 것이 μ€‘μš”ν•˜λ‹€λŠ” 것을 κΈ°μ–΅ν•˜μ‹­μ‹œμ˜€.

그런 λ‹€μŒ λ‚˜λ¨Έμ§€ λ¬Έμ„œμ—μ„œ 일반 λ§ˆν¬λ‹€μš΄μ„ μ‚¬μš©ν•˜μ—¬ λ‹€μŒ ν•­λͺ©μ„ μ‰½κ²Œ 가리킬 수 μžˆμŠ΅λ‹ˆλ‹€.

Learn [how to start well with APIDoc](#api-intro-start-well)

즐기닀!

λͺ¨λ“  4 λŒ“κΈ€

+1은 맀우 쒋을 κ²ƒμž…λ‹ˆλ‹€

예λ₯Ό λ“€μ–΄ 헀더 ν…œν”Œλ¦Ώμ„ μ‚¬μš©ν•˜μ—¬ API의 κ°œμš”(7개 μ„Ήμ…˜ 포함)λ₯Ό μ œκ³΅ν•˜κ³  μ΄λŸ¬ν•œ μ„Ήμ…˜/λΆ€μ œλͺ©λ„ μ‚¬μ΄λ“œλ°”μ—μ„œ 클릭 κ°€λŠ₯ν•œ μ„Ήμ…˜μœΌλ‘œ κ°–λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

+1 λ‚˜λ„ 쀘

μ’‹μ•„μš”, 정말 ν•„μš”ν•΄μ„œ JSλ₯Ό 쑰금 μΌμŠ΅λ‹ˆλ‹€. 관심 μžˆλŠ” μ‚¬λžŒμ΄ κ³΅μœ ν•˜κ³  μ μš©ν•  수 μžˆμ„ 만큼 κΉ¨λ—ν•©λ‹ˆλ‹€. μ—¬κΈ° κ°„λ‹€.

1) apidoc_nav.jsλΌλŠ” νŒŒμΌμ„ λ§Œλ“€κ³  κ·Έ μ•ˆμ— λ‹€μŒ μ½”λ“œλ₯Ό λ„£μŠ΅λ‹ˆλ‹€.

/**
 * Add navigation items by analyzing the HTML content and searching for h2 tags
 * <strong i="7">@param</strong> nav Object the navigation array
 * <strong i="8">@param</strong> content string the compiled HTML content
 * <strong i="9">@param</strong> index where to insert items: either 1 or nav.length
 */
function add_nav(nav, content, index) {
    if (!content)   return;
    var topics = content.match(/<h2>(.+?)<\/h2>/gi);
    topics.forEach(function(entry) {
        var title = entry.replace(/<.+?>/g, '');    // Remove all HTML tags for the title
        var entry_tags = entry.match(/id="(?:api-)?([^\-]+)-(.+)"/);    // Find the group and name in the id property
        var group = (entry_tags ? entry_tags[1] : null);
        var name = (entry_tags ? entry_tags[2] : null);
        if (title && group && name)    {
            nav.splice(index, 0, {
                group: group,
                name: name,
                isHeader: false,
                title: title,
                isFixed: false,
                version: '1.0'
            });
            index++;
        }
    });
}

/**
 * Add navigation items for the header and the footer
 * <strong i="10">@param</strong> nav Object the navigation array
 * <strong i="11">@param</strong> apiProject Object the apiProject data
 */
function add_header_footer_nav(nav, apiProject)
{
    if (apiProject.header) {
        add_nav(nav, apiProject.header.content, 1);
    }
    if (apiProject.footer && apiProject.footer.title != null) {
        add_nav(nav, apiProject.footer.content, nav.length);
    }
}

2) main.js νŒŒμΌμ—μ„œ 220ν–‰ μ£Όμœ„μ— λ‹€μŒ μ½”λ“œλ₯Ό μ‚½μž…ν•©λ‹ˆλ‹€.

    // Add Header and Footer navigation sub-titles
    add_header_footer_nav(nav, apiProject);

3) index.html νŒŒμΌμ—μ„œ main.js 호좜 직전에 apidoc_nav.jsλ₯Ό ν˜ΈμΆœν•©λ‹ˆλ‹€.

<script src="apidoc_nav.js"></script>  <!-- Add this -->
<script data-main="main.js" src="vendor/require.min.js"></script>

그것은 λ¬΄μ—‡μ„ν•©λ‹ˆκΉŒ? μ½”λ“œλŠ” 머리글 및 λ°”λ‹₯κΈ€ νŒŒμΌμ„ ꡬ문 λΆ„μ„ν•˜κ³  <h2> νƒœκ·Έλ₯Ό κ²€μƒ‰ν•©λ‹ˆλ‹€. api-group-something ν˜•μ‹μ„ λ”°λ₯΄λŠ” μ΄λ¦„μœΌλ‘œ id λ₯Ό μΆ”μΆœν•  수 있으면 탐색 λͺ¨μŒμ— ν•­λͺ©μ΄ μƒμ„±λ©λ‹ˆλ‹€. λ”°λΌμ„œ 레벨 2 제λͺ©μ„ λ§Œλ“€κ³  μ•½κ°„μ˜ HTML을 μ‚¬μš©ν•˜μ—¬ 'd'λ₯Ό λΆ™μ΄κΈ°λ§Œ ν•˜λ©΄ λ©λ‹ˆλ‹€.

예:

μ—¬κΈ°μ„œ ## λ§ˆν¬λ‹€μš΄ νƒœκ·Έ 뒀에 <span> νƒœκ·Έλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€. "κ·Έλ£Ή"은 intro 이고 λ‚˜λ¨Έμ§€λŠ” start-well μž…λ‹ˆλ‹€.

## <span id="api-intro-start-well">Starting Well with APIDoc</span>

레벨 2 타이틀에 λŒ€ν•΄ λŒ€μ²΄ ----- λ§ˆν¬λ‹€μš΄ νƒœκ·Έλ₯Ό μ‚¬μš©ν•˜λŠ” λ™μΌν•œ 예:

<span id="api-intro-start-well">Starting Well with APIDoc</span>
----------------------------------------------------------

id κ°€ api- 둜 μ‹œμž‘ν•˜κ³  λ‹€λ₯Έ 단어(κ·Έλ£Ή), λŒ€μ‹œ 및 이름(λŒ€μ‹œλ₯Ό 포함할 수 있음)을 κ°–λŠ” 것이 μ€‘μš”ν•˜λ‹€λŠ” 것을 κΈ°μ–΅ν•˜μ‹­μ‹œμ˜€.

그런 λ‹€μŒ λ‚˜λ¨Έμ§€ λ¬Έμ„œμ—μ„œ 일반 λ§ˆν¬λ‹€μš΄μ„ μ‚¬μš©ν•˜μ—¬ λ‹€μŒ ν•­λͺ©μ„ μ‰½κ²Œ 가리킬 수 μžˆμŠ΅λ‹ˆλ‹€.

Learn [how to start well with APIDoc](#api-intro-start-well)

즐기닀!

μ‚¬μš©μžλ‘œ μ’…λ£Œν•˜λ©΄ μ†”λ£¨μ…˜μ΄ μ œκ³΅λ©λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰