-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MathML support #12836
Add MathML support #12836
Changes from 13 commits
7871260
4197b1c
555d3c1
b614b65
9fe5d53
ff4dd23
d96cafc
f1c81b6
248fcd0
0085161
70160b0
45064bf
744208a
4a89349
c2e79d1
b204fb2
8afa5c1
7d1854f
2145996
1962ff4
6b9c92b
41057a8
70e7b22
ded09a7
60aea54
7673136
a8c7474
9dae400
82344f0
cabddc8
a3a9d94
d3bc097
c518929
873bb8f
d9bd1f9
0cd73f6
17ae03a
d5a9f3f
a1bd164
d3adab3
7367908
6353cfe
2dbbdea
51fe660
6f0728a
c9b9131
6e2afd1
0e3dc5f
0286f09
0e9bd9a
6fdb6e4
0746c11
37c39b5
31cad04
98d0039
85bf039
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* Copyright 2017 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
console.log( 'mathml.js' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't forget to remove. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :doh: |
||
|
||
import {writeScript} from './3p'; | ||
import {user} from '../src/log'; | ||
|
||
/** | ||
* Get the correct script for the gist. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the mathml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, thanks |
||
* | ||
* Use writeScript: Failed to execute 'write' on 'Document': It isn't possible | ||
* to write into a document from an asynchronously-loaded external script unless | ||
* it is explicitly opened. | ||
* | ||
* @param {!Window} global | ||
* @param {string} scriptSource The source of the script, different for post and comment embeds. | ||
*/ | ||
function getMathmlJs(global, scriptSource, cb) { | ||
writeScript(global, scriptSource, function() { | ||
cb(global.gist); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should callback with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right! |
||
}); | ||
} | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function mathml(global, data) { | ||
user().assert( | ||
data.formula, | ||
'The formula attribute is required for <amp-mathml> %s', | ||
data.element); | ||
|
||
getMathmlJs( | ||
global, | ||
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML', | ||
function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use arrow functions and also take in
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it |
||
// Dimensions are given by the parent frame. | ||
delete data.width; | ||
delete data.height; | ||
const div = document.createElement('div'); | ||
div.setAttribute('id','mathmlformula'); | ||
div.innerHTML = data.formula; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. must be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting, ok i'll change and do some testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far my test cases look fine after the change to |
||
document.body.appendChild(div); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, will change - what is the context/reason behind There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may not be the current window in certain situations where an AMP doc is embedded differently. |
||
MathJax.Hub.Queue( function () { | ||
const rendered = document.getElementById('MathJax-Element-1-Frame'); | ||
context.requestResize( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting, will add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aghassemi when adding this I noticed on a line I was touching that the check for 'github' isn't using a strict equality check, see https://github.com/ampproject/amphtml/blob/master/3p/ampcontext-integration.js#L72 This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our JS compiler handles discrepencies between |
||
rendered./*OK*/offsetWidth + 20, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think i was getting cut off display, i'll retest and remove or document reason There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My display was cut off when removing the extra height (https://cl.ly/1G243K2x3W3X) - I tracked this down to same margins built into the formulas rendered by MathJax. I added some code removing them on the fly in 70e7b22. Do I need to add more resiliency here, checking that I found the element before applying styles? |
||
rendered./*OK*/offsetHeight + 20 | ||
); | ||
} ); | ||
|
||
} | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>amp-mathml example</title> | ||
<link rel="canonical" href="amps.html"> | ||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | ||
<script async custom-element="amp-mathml" src="https://cdn.ampproject.org/v0/amp-mathml-0.1.js"></script> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
</head> | ||
<body> | ||
<h2>The Quadratic Formula</h2> | ||
<amp-mathml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all samples now should now only do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's also add one sample that's inline in a sentence. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
layout="responsive" | ||
width="100" height="100" data-formula="\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]"> | ||
</amp-mathml> | ||
<h2>Cauchy's Integral Formula</h2> | ||
<amp-mathml | ||
layout="responsive" | ||
width="100" height="100" data-formula="\[f(a) = \frac{1}{2\pi i} \oint\frac{f(z)}{z-a}dz\]"> | ||
</amp-mathml> | ||
<h2>Double angle formula for Cosines</h2> | ||
<amp-mathml | ||
layout="responsive" | ||
width="100" height="100" data-formula="\[ \cos(θ+φ)=\cos(θ)\cos(φ)−\sin(θ)\sin(φ) \]"> | ||
</amp-mathml> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright 2018 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import {isLayoutSizeDefined} from '../../../src/layout'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
import {Layout} from '../../../src/layout'; | ||
import {cssstyle} from 'cssstyle'; | ||
import {getIframe} from '../../../src/3p-frame'; | ||
import { addParamsToUrl } from '../../../src/url'; | ||
import { getDataParamsFromAttributes, removeElement } from '../../../src/dom'; | ||
import { listenFor } from '../../../src/iframe-helper'; | ||
|
||
export class AmpMathml extends AMP.BaseElement { | ||
|
||
/** @param {!AmpElement} element */ | ||
constructor(element) { | ||
super(element); | ||
|
||
/** @private {!Element} */ | ||
this.container_ = this.win.document.createElement('div'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not used, remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
||
/** @private {?HTMLIFrameElement} */ | ||
this.iframe_ = null; | ||
} | ||
|
||
/** | ||
* @param {boolean=} opt_onLayout | ||
* @override | ||
*/ | ||
preconnectCallback () { | ||
this.preconnect.url('https://cdnjs.cloudflare.com'); | ||
} | ||
/** @override */ | ||
buildCallback() { | ||
const formula = this.element.getAttribute('formula'); | ||
if (!formula || '' === formula) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's have
here instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that bit is in mathml.js, i removed the buildCallback entirely, it seems superfluous |
||
return; | ||
} | ||
this._formula = formula; | ||
} | ||
layoutCallback () { | ||
const iframe = getIframe(this.win, this.element, 'mathml'); | ||
this.applyFillContent(iframe); | ||
// Triggered by context.updateDimensions() inside the iframe. | ||
listenFor(iframe, 'embed-size', data => { | ||
this./*OK*/changeHeight(data['height']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can become But I believe we should not change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, got it. currently my iframes aren't rendering locally so hard to test; this change looks good to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works great, thanks! |
||
}, /* opt_is3P */true ); | ||
this.element.appendChild(iframe); | ||
this.iframe_ = iframe; | ||
return this.loadPromise(iframe); | ||
} | ||
|
||
unlayoutCallback () { | ||
if (this.iframe_) { | ||
removeElement(this.iframe_); | ||
this.iframe_ = null; | ||
} | ||
return true; | ||
} | ||
|
||
/** @override */ | ||
isLayoutSupported (layout) { | ||
return isLayoutSizeDefined(layout); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, changed |
||
} | ||
|
||
} | ||
|
||
|
||
AMP.extension('amp-mathml', '0.1', AMP => { | ||
AMP.registerElement('amp-mathml', AmpMathml); | ||
} ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Copyright 2018 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {AmpMathml} from '../amp-mathml'; | ||
|
||
describes.realWin('amp-mathml', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for testing, I recommend writing end-2-end integration tests. https://github.com/ampproject/amphtml/blob/master/extensions/amp-sidebar/0.1/test/integration/test-amp-sidebar.js is a good one to use as reference. In short, the test will essentially render an AMP page with bunch of |
||
amp: { | ||
extensions: ['amp-mathml'], | ||
} | ||
}, env => { | ||
|
||
let win; | ||
let element; | ||
|
||
beforeEach(() => { | ||
win = env.win; | ||
element = win.document.createElement('amp-mathml'); | ||
win.document.body.appendChild(element); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!-- | ||
Copyright 2018 The AMP HTML Authors. All Rights Reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS-IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# <a name="`amp-mathml`"></a> `amp-mathml` | ||
|
||
<table> | ||
<tr> | ||
<td width="40%"><strong>Description</strong></td> | ||
<td>FILL THIS IN</td> | ||
</tr> | ||
<tr> | ||
<td width="40%"><strong>Availability</strong></td> | ||
<td>FILL THIS IN</td> | ||
</tr> | ||
<tr> | ||
<td width="40%"><strong>Required Script</strong></td> | ||
<td><code><script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-mathml-0.1.js"></script></code></td> | ||
</tr> | ||
<tr> | ||
<td class="col-fourty"><strong><a href="https://www.ampproject.org/docs/guides/responsive/control_layout.html">Supported Layouts</a></strong></td> | ||
<td>FILL THIS IN</td> | ||
</tr> | ||
<tr> | ||
<td width="40%"><strong>Examples</strong></td> | ||
<td>FILL THIS IN</td> | ||
</tr> | ||
</table> | ||
|
||
## Behavior | ||
|
||
FILL THIS IN. What does this extension do? | ||
|
||
## Attributes | ||
|
||
FILL THIS IN. Does this extension allow for properties to configure? | ||
|
||
## Validation | ||
See [amp-mathml rules](https://github.com/ampproject/amphtml/blob/master/extensions/amp-mathml/validator-amp-mathml.protoascii) in the AMP validator specification. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please take a look at Contributing Validator Rules. The format for allowing the script tag has been simplified greatly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, will do - thanks for the feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fixed the extensions/amp-mathml/validator-amp-mathml.protoascii file in f6d93f3 - I still need to add some valid and invalid test cases |
||
# Copyright 2018 The AMP HTML Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS-IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the license. | ||
# | ||
|
||
tags: { # amp-mathml | ||
html_format: AMP | ||
tag_name: "SCRIPT" | ||
spec_name: "amp-mathml extension .js script" | ||
satisfies: "amp-mathml extension .js script" | ||
requires: "amp-mathml" | ||
mandatory_parent: "HEAD" | ||
unique: true | ||
extension_unused_unless_tag_present: "amp-mathml" | ||
attrs: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
name: "async" | ||
mandatory: true | ||
value: "" | ||
} | ||
attrs: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
name: "formula" | ||
mandatory: true | ||
} | ||
attrs: { | ||
name: "custom-element" | ||
mandatory: true | ||
value: "amp-mathml" | ||
dispatch_key: true | ||
} | ||
attrs: { name: "nonce" } | ||
attrs: { | ||
name: "src" | ||
mandatory: true | ||
value_regex: "https://cdn\.ampproject\.org/v0/amp-mathml-(latest|0\.1).js" | ||
} | ||
attrs: { | ||
name: "type" | ||
value: "text/javascript" | ||
} | ||
cdata: { | ||
blacklisted_cdata_regex: { | ||
regex: "." | ||
error_message: "contents" | ||
} | ||
} | ||
spec_url: "https://www.ampproject.org/docs/reference/components/amp-mathml" | ||
} | ||
tags: { # <amp-mathml> | ||
html_format: AMP | ||
tag_name: "AMP-MATHML" | ||
satisfies: "amp-mathml" | ||
requires: "amp-mathml extension .js script" | ||
attr_lists: "extended-amp-global" | ||
spec_url: "https://www.ampproject.org/docs/reference/components/amp-hello-world" | ||
amp_layout: { | ||
supported_layouts: RESPONSIVE | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ declareExtension('amp-lightbox', '0.1', true); | |
declareExtension('amp-lightbox-viewer', '0.1', true); | ||
declareExtension('amp-list', '0.1', false); | ||
declareExtension('amp-live-list', '0.1', true); | ||
declareExtension('amp-mathml', '0.1', false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we need a
Note: we may need to do
to make it not be 0by0 until resize happens. Try it without the above 1px hacks, if it works all is good. Otherwise if you see mathML not rendering, we may need to add them. (This is because AMP tends to ignore elements that are 0x0) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 1px settings were required, without that the iframe never rendered. |
||
declareExtension('amp-mustache', '0.1', false); | ||
declareExtension('amp-nexxtv-player', '0.1', false); | ||
declareExtension('amp-o2-player', '0.1', false); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!doctype html> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep this in the extension folder. Also needs a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i have an uncommitted out file that i think was generated when i started, I'll check that and commit it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the file, but I am still missing something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this file to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See here for an example extensions test directory with an .html and .out. |
||
<html ⚡> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>amp-mathml example</title> | ||
<link rel="canonical" href="amps.html"> | ||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | ||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> | ||
<style amp-custom> | ||
amp-mathml { | ||
color: red; | ||
} | ||
</style> | ||
<script async custom-element="amp-mathml" src="https://cdn.ampproject.org/v0/amp-mathml-0.1.js"></script> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
</head> | ||
<body> | ||
<amp-mathml layout="responsive" formula="\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]"> | ||
</amp-mathml> | ||
<h2>Cauchy's Integral Formula</h2> | ||
<amp-mathml layout="responsive" formula="\[f(a) = \frac{1}{2\pi i} \oint\frac{f(z)}{z-a}dz\]"> | ||
</amp-mathml> | ||
<h2>Double angle formula for Cosines</h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add one with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added, copied over all of items from examples. |
||
<amp-mathml layout="responsive" formula="\[ \cos(θ+φ)=\cos(θ)\cos(φ)−\sin(θ)\sin(φ) \]"> | ||
</amp-mathml> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2018 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yea; sorry, i started by copying an existing component, I'll clean this up.