Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 549786 - API doc parser and client-side renderer
Browse files Browse the repository at this point in the history
This updates the "cfx docs" server-side API parser, to take an .md file and
turn it into a JSON data structure. The cfx docs server provides this JSON
over HTTP when asked for e.g. packages/jetpack-core/docs/url.md.json . The
client-side javascript now has code to render the JSON into HTML instead of
rendering just the markdown (e.g. docs/url.md), giving us nicely-formatted
API docs.
  • Loading branch information
warner committed Apr 9, 2010
1 parent 6c10603 commit 55e4540
Show file tree
Hide file tree
Showing 10 changed files with 969 additions and 300 deletions.
64 changes: 28 additions & 36 deletions packages/jetpack-core/docs/url.md
@@ -1,47 +1,39 @@
The <tt>url</tt> module provides functionality for the parsing and
The `url` module provides functionality for the parsing and
retrieving of URLs.

<tt>url.**toFilename**(*url*)</tt>

<api name="toFilename">
@method
Attempts to convert the given URL to a native file path. This
function will automatically attempt to resolve non-file protocols,
such as the <tt>resource:</tt> protocol, to their place on the file
such as the `resource:` protocol, to their place on the file
system. An exception is raised if the URL can't be converted;
otherwise, the native file path is returned as a string.
@param url {string} The URL to be converted.
</api>

<tt>url.**fromFilename**(*path*)</tt>

Converts the given native file path to a <tt>file:</tt> URL.

<tt>url.**resolve**(*base*, *relative*)</tt>
<api name="fromFilename">
@method
Converts the given native file path to a `file:` URL.
@param path {string}
</api>

<api name="resolve">
@method
Returns an absolute URL given a base URL and a relative URL.
@param base {string}
@param relative {boolean}
</api>

<tt>url.**parse**(*url*)</tt>

<api name="parse">
@method
Parses the URL and returns an object with following keys:

<table>
<tr>
<td><tt>scheme</tt></td>
<td>The name of the protocol in the URL.</td>
</tr>
<tr>
<td><tt>userPass</tt></td>
<td>The username:password part of the URL; <tt>null</tt> if not
present.</td>
</tr>
<tr>
<td><tt>host</tt></td>
<td>The host of the URL, <tt>null</tt> if not present.</td>
</tr>
<tr>
<td><tt>port</tt></td>
<td>The port number of the URL, <tt>null</tt> if none was
specified.</td>
</tr>
<tr>
<td><tt>path</tt></td>
<td>The path component of the URL.</td>
</tr>
</td>
@returns {object}
@prop [scheme] {string} The name of the protocol in the URL.
@prop [userPass] {string} The username:password part of the URL; `null` if
not present.
@prop [host] {string} The host of the URL, `null` if not present.
@prop [port] {int} The port number of the URL, `null` if none was
specified.
@prop [path] {string} The path component of the URL.
@param url {string}
</api>

0 comments on commit 55e4540

Please sign in to comment.