Skip to content

Instantly share code, notes, and snippets.

JavaScript reference docs structure specification

This document describes the structure we want to require for JavaScript reference documentation.

Recipes and ingredients overview

It is expected that pages documenting different sorts of thing will need to contain different elements. For example, the page for the JavaScript BigInt class will want to contain lists of links to its members, while the page for the JavaScript BigInt.asUintN() static method will want to contain a section describing the method syntax.

To reflect this, a "recipe" is a short YAML file that describes at a high level the elements that a particular type of page is expected to have. A recipe provides a list of elements, that are expected to appear in the page in the order given. So for each distinct type of page, we define a single recipe.

@wbamberg
wbamberg / base64.js
Last active February 25, 2020 02:47
"use strict";
function toBinary(string) {
const codeUnits = new Uint16Array(string.length);
for (let i = 0; i < codeUnits.length; i++) {
codeUnits[i] = string.charCodeAt(i);
}
return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
}
<div class="bc-data" id="bcd:html.elements.video"><a class="bc-github-link external" href="https://github.com/mdn/browser-compat-data" rel="noopener">Update compatibility data on GitHub</a><table class="bc-table bc-table-web"><thead><tr class="bc-platforms"><td></td><th class="bc-platform-desktop" colspan="6"><span>Desktop</span></th><th class="bc-platform-mobile" colspan="6"><span>Mobile</span></th></tr><tr class="bc-browsers"><td></td><th class="bc-browser-chrome"><span class="bc-head-txt-label bc-head-icon-chrome">Chrome</span></th><th class="bc-browser-edge"><span class="bc-head-txt-label bc-head-icon-edge">Edge</span></th><th class="bc-browser-firefox"><span class="bc-head-txt-label bc-head-icon-firefox">Firefox</span></th><th class="bc-browser-ie"><span class="bc-head-txt-label bc-head-icon-ie">Internet Explorer</span></th><th class="bc-browser-opera"><span class="bc-head-txt-label bc-head-icon-opera">Opera</span></th><th class="bc-browser-safari"><span class="bc-head-txt-label bc-head-icon-safari">Safa
* Learn HTML
* Introduction
[chapters]
* Multimedia and embedding
[chapters]
* Forms
[chapters]
* Tables
[chapters]
* Reference
{
"html": {
"elements": {
"aside": {
"title": "<aside>: The Aside element",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTML/Element/aside",
"interactive-example": "https://interactive-examples.mdn.mozilla.net/pages/tabbed/aside.html",//optional
"browser-compatibility": {//bcd_for_html.elements.aside},
"examples": [
{

For each page:

Attaching to kuma_kumascript_1
kumascript_1 | internal/modules/cjs/loader.js:583
kumascript_1 | throw err;
kumascript_1 | ^
kumascript_1 |
kumascript_1 | Error: Cannot find module 'winston'
kumascript_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
kumascript_1 | at Function.Module._load (internal/modules/cjs/loader.js:507:25)
kumascript_1 | at Module.require (internal/modules/cjs/loader.js:637:17)
kumascript_1 | at require (internal/modules/cjs/helpers.js:22:18)
Name Command State Ports
--------------------------------------------------------------------------------
kuma_api_1 gunicorn -w 4 --bind Up 0.0.0.0:8001->8000/tcp
0.0.0 ...
kuma_elasticsearch_1 /bin/bash bin/es-docker Up 9200/tcp, 9300/tcp
kuma_kumascript_1 node run.js Exit 1
kuma_memcached_1 docker-entrypoint.sh Up 11211/tcp
memcached
kuma_mysql_1 docker-entrypoint.sh Up 3306/tcp
mysql ...
./svg/attributes/xlink.json: "description": "<code>xlink:actuate</code>",
./svg/attributes/xlink.json: "description": "<code>xlink:arcrole</code>",
./svg/attributes/xlink.json: "description": "<code>xlink:role</code>",
./svg/attributes/xlink.json: "description": "<code>xlink:show</code>",
./svg/attributes/xlink.json: "description": "<code>xlink:title</code>",
./svg/attributes/xlink.json: "description": "<code>xlink:type</code>",
./svg/attributes/style.json: "description": "Animation support",
./svg/attributes/core.json: "description": "xml:base",
./svg/attributes/core.json: "description": "xml:lang",
./svg/attributes/core.json: "description": "xml:space",
$ docker-compose exec web ./manage.py migrate
System check identified some issues:
WARNINGS:
?: (django_mysql.W001) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://django-mysql.readthedocs.io/en/latest/checks.html#django-mysql-w001-strict-mode
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
Operations to perform:
Apply all migrations: account, admin, attachments, auth, authkeys, contenttypes, core, database, djcelery, feeder, search, sessions, sites, soapbox, socialaccount, taggit, tidings, users, w