From a9d6514da9d203174d771ff35779518bd2112be7 Mon Sep 17 00:00:00 2001 From: Jonathan Olson Date: Thu, 6 Apr 2017 02:51:15 -0600 Subject: [PATCH] RichText documentation, see https://github.com/phetsims/chains/issues/3 --- js/RichText.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/js/RichText.js b/js/RichText.js index 224d51fc5..9163e40f6 100644 --- a/js/RichText.js +++ b/js/RichText.js @@ -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: + * - and for bold text + * - and for italic text + * - and for subscripts / superscripts + * - for underlined text + * - for strikethrough text + * - tags with attributes color="cssString", face="familyString", size="cssSize" + * - 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 bold and italic text.' ), + * new RichText( 'Can do H2O (Asub and Asup), or nesting: x22' ), + * new RichText( 'Additionally: color, sizes, faces, strikethrough, and underline' ), + * new RichText( 'These can be mixed1.' ), + * new RichText( '\u202aHandles bidirectional text: \u202bمقابض النص ثنائي الاتجاه2\u202c\u202c' ) * * @author Jonathan Olson */