Kuma入门

草案
本页尚未完工.

This is an introductory guide to the Kuma wiki platform that powers MDN. "Kuma" is the Japanese word for "bear;" we chose this name because it's a bigger, more powerful creature than Kitsune, the software on which it's based that powers the SUMO web site.

Note: Much of this needs to move into the MDN user guide content, and this isn't necessarily well organized.

Development process

Servers

We have several servers for MDN, based on the state of development of the platform.

Environment URL Purpose
Development https://developer-dev.allizom.org/ Newest features and fixes are added immediately after they pass code review.
Stage https://developer.allizom.org/ Beta features and fixes that will go on the next push to production.
Production https://developer.mozilla.org/ The live MDN server. You're looking at it.

Tracking development

You can see information about recent pushes of code updates to the production server on our Changelog page.

Things that work differently

Redirects

The syntax for redirects has changed. You now type the word "REDIRECT" followed by a standard HTML link to the page to redirect to. Switch to source editing mode, then type something like:

REDIRECT <a class="redirect" href="/destination/url/here">some title text here</a>

The URL (href) must be a full path from the base of the site, like "/en-US/docs/foo". Relative URLs will not work. However, you can specify a section within the page using a hashmark ("#") character, such as "/destination/url/here#section_name".

By default, you create links by specifying as the anchor (that is, the part after the hash or "#" symbol) the heading name of the section you want to link to. However, if you're concerned that this might break if headings are changed over time, there's a way to create permanent references for headings. Just add the name attribute to the heading element. Currently you need to do this in the source editor, but in the future we intend to have a user interface for this. Here's an example of what this might look like in the source:

<h2 name="Doing_foo">All about foo</h2>

Now how can link to this section, even if the title's text changes, using {{anch("Doing foo")}}, or by using "/en-US/path/to/article#Doing_foo" as the link destination.

New features of Kuma

Localization and Translation

KumaScript

See Introduction to KumaScript

Live samples

You can create live samples in Kuma by adding special markup. For example:

<section id="live-sample">
  <pre class="brush: html"><p class="shadow">text-shadow</p></pre>
  <pre class="brush: css">.shadow { text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue; }</pre>
  <pre class="brush: js">window.alert("Alert!")</pre>
</section>

Note: You should wrap the code blocks in a non-fragment element - i.e., <section> instead of <ul>

To display the sample live, use an iframe with src of http://page-url$samples/{section_id}. E.g., https://developer.mozilla.org/en-US/docs/Project:Getting_started_with_Kuma$samples/live_samples.

<p class="shadow">text-shadow</p>
.shadow { text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue; }
console.log("Alert!")

Note: See the documentation about this in the MDN editor guide for more information about how to use the built-in tools for more easily building live samples.

Finding pages

There are some special search queries you can use to find things:

Search URL Description
https://developer.mozilla.org/admin/wiki/document/?slug__startswith=term Searches for pages whose slug starts with the given term.
https://developer.mozilla.org/admin/wiki/document/?slug__contains=term Searches for pages whose slug contains the given term.

Attachments

You can see a list of all attached files.

Automating and feeds

Kuma offers an an API for retrieving information and (eventually) automatically updating content. See The Kuma API for details.

Additionally, Kuma provides a number of RSS feeds that you can use to monitor the site. See Kuma RSS feeds.

See also

Document Tags and Contributors

Contributors to this page: xcffl
最后编辑者: xcffl,