Skip to content

Commit

Permalink
RichText documentation, see phetsims/chains#3
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Apr 6, 2017
1 parent f026155 commit a9d6514
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion js/RichText.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
// Copyright 2017, University of Colorado Boulder

/**
* Displays rich text with HTML-style tags for styling.
* Displays rich text with HTML-style tags by splitting it into multiple (child) Text nodes.
*
* It should be a close to drop-in replacement for SubSupText, and supports the following markup and features:
* - <b> and <strong> for bold text
* - <i> and <em> for italic text
* - <sub> and <sup> for subscripts / superscripts
* - <u> for underlined text
* - <s> for strikethrough text
* - <font> tags with attributes color="cssString", face="familyString", size="cssSize"
* - <span> tags with a dir="ltr" / dir="rtl" attribute
* - Unicode bidirectional marks (present in PhET strings) for full RTL support
*
* Examples from the scenery-phet demo:
*
* new RichText( 'RichText can have <b>bold</b> and <i>italic</i> text.' ),
* new RichText( 'Can do H<sub>2</sub>O (A<sub>sub</sub> and A<sup>sup</sup>), or nesting: x<sup>2<sup>2</sup></sup>' ),
* new RichText( 'Additionally: <font color="blue">color</font>, <font size="30px">sizes</font>, <font face="serif">faces</font>, <s>strikethrough</s>, and <u>underline</u>' ),
* new RichText( 'These <b><em>can</em> <u><font color="red">be</font> mixed<sup>1</sup></u></b>.' ),
* new RichText( '\u202aHandles bidirectional text: \u202b<font color="#0a0">مقابض</font> النص ثنائي <b>الاتجاه</b><sub>2</sub>\u202c\u202c' )
*
* @author Jonathan Olson <[email protected]>
*/
Expand Down

0 comments on commit a9d6514

Please sign in to comment.