--- title: Links slug: MDN/Editor/Links tags: - MDN - 가이드 - 문서화 - 에디터 translation_of: MDN/Editor/Links ---
링크는 어떤 위키에서나 가장 중요한 요소입니다. 그 중요성은 많은 문서간에서 뿐만 아니라, 단일 문서에서도 동일합니다. MDN 또한 링크에 크게 의존하고 있습니다. 다행스럽게도, 링크는 만들 수있는 방법이 많으면서도, 매우 만들기 쉽습니다!
주목할 점: 특별히 링크시에 선호되는 작성방법이 있습니다; MDN 작성 스타일 가이드에 설명되어 있습니다.
링크를 만드는 가장 확실한 방법은 툴바의 "link" 버튼을 클릭하거나, Ctl+K (맥에서는 Command-K )를 누르는 것입니다. 링크 버튼은 이렇게 생겼습니다: . 문자열 선택없이 링크 작성시에, 혹은 기존에 있는 문자열을 선택하여 링크 작성시에 이 기능을 이용할 수 있습니다.
일단 링크 버튼을 클릭하면, 아래에 보이는 링크 에디터 다이얼로그로 진입합니다:
여기서 새로운 링크를 구성할 수 있습니다. 이 다이얼로그의 콘트롤은 다음과 같습니다:
mailto:
URL 이 구성되도록 합니다. 대부분의 경우 URL optin을 사용하게 될 겁니다.Once the link is configured, click the OK button to insert it.
If you're paying attention, you'll see that there's a second tab—Advanced—in the link editor dialog. There are no options there that we advise you to use on a regular basis, at least at this time. It's possible that in the future there will be alternate styles for links, but we will likely add new toolbar widgets to use those features when they're available.
If you have existing text that you'd like to turn into a link, you can simplify the process somewhat. Highlight the text you'd like to turn into a link before opening the link editor; this will pre-populate the Article Title/Lookup Text field with the selected text. For example, let's say we have the following text:
You may find it useful to use JavaScript arrays when working on this project.
We'd like to turn "arrays" into a link to the appropriate content. Just highlight that word and invoke the link editor; you'll get a pre-populated dialog similar to the previous case. By "hovering" your mouse over a suggested article, you can see its relative slug (its URL relative to developer.mozilla.org
), which can give you a better idea of where it is located and what type of article it is.
Here, of the articles suggested as possible matches. "Arrays" looks like a good choice, so we can choose that. This automatically fills in the URL field, so you can just click OK and the text gets turned into a link, like this:
You may find it useful to use JavaScript arrays when working on this project.
MDN은, 선택된 용어에 적절한 콘텐츠로의 링크가 자동적으로 생성되는 동시에 스타일 가이드에 맞게 링크가 생성되도록 하는 작업을 매크로에 크게 의존합니다. 이 예를 보세요: 우리의 스타일 가이드는 API 용어 이름, HTML 요소와 속성, CSS 속성, 함수 이름등이 {{HTMLElement("code")}} 형식을 권장한다( 사실상 그대로 되어야 합니다)라고 되어있습니다. 그것들은 또한 MDN상의 적절한 페이지로 링크가 연결되어있어야 합니다.
매크로를 이용하여 이런 링크들을 만드는 것은 익숙해지기에 약간 시간이 걸리지만 많은 장점이 있습니다:
이런 종류의 매크로가 많이 있으며, 여기서 모든 매크로를 다 보지는 않을 겁니다. 대신, 가장 일반적인 몇가지 특별한 예를 살펴볼 것입니다. 더 완벽한 목록은 MDN 커스텀 매크로 가이드의 "하이퍼링크 생성하기" 섹션을 보세요. 모든 매크로에 대해서 KumaScript 소스 코드를 확인할 수 있다는 점은 주목할만 합니다. 대부분의 경우 소스코드 상단에 작동 방식과 다양한 매개변수가 무엏인지 설명하는 주석이 있습니다.
We have a number of extremely helpful macros for creating styled links to APIs. Here are a few of the most useful ones; in each case, there may be added parameters available to give you more control over the output (such as suppressing the automatic addition of the <code>
styling). Each macro name below can be clicked upon to read the macro code itself; they all have comments at the top explaining what they do and all of their parameters.
\{{HTMLElement("table")}}
yields {{HTMLElement("table")}}.\{{cssxref("background-color")}}
results in {{cssxref("background-color")}}.\{{domxref("window")}}
yields {{domxref("window")}} and \{{domxref("window.scrollBy()")}}
inserts {{domxref("window.scrollBy()")}}. You can also supply an additional parameter to override the text: \{{domxref("window.scrollBy", "scrollBy()")}}
results in {{domxref("window.scrollBy", "scrollBy()")}}.\{{SVGElement("circle")}}
yields {{SVGElement("circle")}}.To link to a section within the same article, you can use the {{TemplateLink("anch")}} macro. The syntax is straightforward: \{{anch("Name of destination section")}}
. By default, the displayed link text is the title of that section, but you can add a second, optional, parameter indicating alternate text to use instead. Some examples:
\{{anch("Using the toolbar")}}
looks like this: {{anch("Using the toolbar")}}\{{anch("Using the toolbar", "earlier in this article")}}
looks like this: {{anch("Using the toolbar", "earlier in this article")}}You can link to a bug in Mozilla's Bugzilla database with the {{TemplateLink("bug")}} macro. This macro accepts a single parameter: the bug number to link to. For example, \{{bug(765642)}}
looks like this: {{bug(765642)}}.
Similarly, you can create links to bugs in other browsers and Web engines:
\{{webkitbug(31277)}}
yields {{webkitbug(31277)}}.Much of the way the Internet works at a core level is documented in RFCs. You can easily reference RFCs using the {{TemplateLink("RFC")}} macro. For example, \{{RFC(2616)}} becomes {{RFC(2616)}}. You can, optionally, also provide alternate link text to use instead of a selected piece of text from the article or and/or the section number within the specification to which to link.
The MDN staff no longer actively maintains the XPCOM documentation, but volunteer contributions are welcomel
If you're documenting Mozilla internals, being able to easily create links to XPCOM interface documentation is helpful. There are a few macros used for this.
The syntax for linking to the documentation for an XPCOM interface as a whole is just: \{{interface("interfacename")}}
. For example, you might write:
When you need to parse or create URIs, the \{{interface("nsIIOService")}} interface can help.
The result looks like this:
When you need to parse or create URIs, the {{interface("nsIIOService")}} interface can help.
If you need to link to information about a specific method or attribute on an XPCOM interface, the {{TemplateLink("ifmethod")}} and {{TemplateLink("ifattribute")}} macros are for you. These accept as parameters the name of the interface and the name of the method or attribute to which you wish to reference. The {{TemplateLink("ifmethod")}} macro is particularly interesting, since it does some special formatting by adding the style guide-mandated parentheses after the method's name. For example, \{{ifmethod("nsIIOService", "newURI")}}
results in {{ifmethod("nsIIOService", "newURI")}}. That's a case where you're being protected against possible changes in the style guide in the future!
To insert the name of a Mozilla preference and make it link to the corresponding page in the Preference reference, use the {{TemplateLink("pref")}} macro. This accepts one parameter: the full name of the preference you wish to link to. For example, you can use \{{pref("javascript.options.showInConsole")}}
to create this: {{pref("javascript.options.showInConsole")}}.
You can link to files in Mozilla's source tree (although you probably won't do this often) using the {{TemplateLink("source")}} macro. Instead of specifying the full URL of the file, you can simply specify the path relative to the /source/
directory. For example: \{{source("browser/Makefile.in")}} creates this link: {{source("browser/Makefile.in")}}.
You may also, optionally, specify alternative text to use for the link. For example, you can use \{{source("browser/Makefile.in", "the browser's makefile")}} to get the result: {{source("browser/Makefile.in", "the browser's makefile")}}.
Please look at the {{anch("Using macros")}} documentation if you're interested in learning more about using macros, and check out our KumaScript documentation to learn more about the macro system itself.
If you wish to create a list of related pages, or other recommended reading material, you should do so by creating a quicklinks box in the sidebar; this mechanism is replacing our old "See also" headings at the end of articles. For details on how to create quicklinks boxes, see Quicklinks.
For security reasons, you should only create links that use the following schemes:
http://
https://
ftp://
mailto:
Others may or may not work, but are not supported and will probably be removed by editorial staff.
Special URL schemes such as about:
and chrome:
are used by Firefox, Google Chrome, and some other browsers to provide access to special content such as preferences, debugging information, and so forth. These links do not work from article content, so please do not try to create links using these schemes within MDN articles. The same applies to the javascript:
and jar:
schemes, which are blocked by most modern browsers as a security precaution.
{{EditorGuideQuicklinks}}