diff --git a/.gitignore b/.gitignore index e2f6f77d2f09d..b7e395980c637 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ docs/css/react.css docs/js/JSXTransformer.js docs/js/react.min.js docs/js/docs.js +docs/js/jsx-compiler.js docs/js/live_editor.js docs/js/examples docs/downloads diff --git a/docs/_config.yml b/docs/_config.yml index fab82062742dc..486c3e2ae9abb 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,14 +1,14 @@ ---- +--- pygments: true name: React react_version: 0.3.0 -exclude: +exclude: - Gemfile - Gemfile.lock - README.md - Rakefile -redcarpet: - extensions: +redcarpet: + extensions: - fenced_code_blocks markdown: redcarpet baseurl: /react diff --git a/docs/_css/react.scss b/docs/_css/react.scss index 83e8b5b24fa44..72577c495d8b1 100644 --- a/docs/_css/react.scss +++ b/docs/_css/react.scss @@ -3,6 +3,12 @@ @import '_typography'; @import '_solarized'; +@mixin code-typography { + font-family: 'source-code-pro', Menlo, 'Courier New', Consolas, monospace; + font-size: 13px; + line-height: 20px; +} + $skinnyContentWidth: 650px; $contentWidth: 920px; $contentPadding: 20px; @@ -396,6 +402,26 @@ section.black content { padding-bottom: 40px; } +/* JSX Compiler */ + +.jsxCompiler { + margin: 0 auto; + padding-top: 20px; + width: 1220px; + + #jsxCompiler { + margin-top: 20px; + } + + .playgroundPreview { + padding: 14px; + width: 600px; + + pre { + @include code-typography; + } + } +} /* Button */ @@ -482,9 +508,7 @@ p { /* Code Mirror */ div.CodeMirror pre, div.CodeMirror-linenumber, code { - font-family: 'source-code-pro', Menlo, 'Courier New', Consolas, monospace; - font-size: 13px; - line-height: 20px; + @include code-typography; } div.CodeMirror-linenumber:after { diff --git a/docs/_js/jsx-compiler.js b/docs/_js/jsx-compiler.js new file mode 100644 index 0000000000000..0273464656a54 --- /dev/null +++ b/docs/_js/jsx-compiler.js @@ -0,0 +1,19 @@ +/** + * @jsx React.DOM + */ + +var HELLO_COMPONENT = "\ +/** @jsx React.DOM */\n\ +var HelloMessage = React.createClass({\n\ + render: function() {\n\ + return
{this.getDesugaredCode()}, + mountNode + ); + } else { + eval(this.getDesugaredCode()); + } } catch (e) { - React.renderComponent(, mountNode); + React.renderComponent( + , + mountNode + ); } } }); diff --git a/docs/docs/syntax.md b/docs/docs/syntax.md index 4520e37666fb3..e4b099bd23280 100644 --- a/docs/docs/syntax.md +++ b/docs/docs/syntax.md @@ -52,8 +52,11 @@ var app = ; var app = Nav({color:'blue'}, Profile({}, 'click')); ``` -The [Getting Started](getting-started.html) guide shows how to setup JSX -compilation. +Use the [JSX Compiler](/react/jsx-compiler.html) to try out JSX and see how it +desguars into native JavaScript. + +If you want to use JSX, the [Getting Started](getting-started.html) guide shows +how to setup compilation. > Note: > diff --git a/docs/jsx-compiler.md b/docs/jsx-compiler.md new file mode 100644 index 0000000000000..b0a1adaedbfb1 --- /dev/null +++ b/docs/jsx-compiler.md @@ -0,0 +1,14 @@ +--- +layout: default +title: JSX Compiler Service +id: jsx-compiler +--- +
+ This tool demonstrates how JSX syntax + is desguared into native JavaScript. +
+ + +