File tree 2 files changed +33
-22
lines changed
2 files changed +33
-22
lines changed Original file line number Diff line number Diff line change @@ -854,6 +854,26 @@ function loadingDisplaying(p5, fn){
854
854
* destination image's top left corner. See
855
855
* <a href="#/p5/imageMode">imageMode()</a> for other ways to position images.
856
856
*
857
+ * ```js example
858
+ * let img;
859
+ *
860
+ * // Load the image.
861
+ * function preload() {
862
+ * img = loadImage('assets/laDefense.jpg');
863
+ * }
864
+ *
865
+ * function setup() {
866
+ * createCanvas(100, 100);
867
+ *
868
+ * background(50);
869
+ *
870
+ * // Draw the image.
871
+ * image(img, 0, 0);
872
+ *
873
+ * describe('An image of the underside of a white umbrella with a gridded ceiling above.');
874
+ * }
875
+ * ```
876
+ *
857
877
* Here's a diagram that explains how optional parameters work in `image()`:
858
878
*
859
879
* <img src="assets/drawImage.png"></img>
@@ -907,28 +927,6 @@ function loadingDisplaying(p5, fn){
907
927
* background(50);
908
928
*
909
929
* // Draw the image.
910
- * image(img, 0, 0);
911
- *
912
- * describe('An image of the underside of a white umbrella with a gridded ceiling above.');
913
- * }
914
- * </code>
915
- * </div>
916
- *
917
- * <div>
918
- * <code>
919
- * let img;
920
- *
921
- * // Load the image.
922
- * function preload() {
923
- * img = loadImage('assets/laDefense.jpg');
924
- * }
925
- *
926
- * function setup() {
927
- * createCanvas(100, 100);
928
- *
929
- * background(50);
930
- *
931
- * // Draw the image.
932
930
* image(img, 10, 10);
933
931
*
934
932
* describe('An image of the underside of a white umbrella with a gridded ceiling above. The image has dark gray borders on its left and top.');
Original file line number Diff line number Diff line change @@ -39,6 +39,19 @@ function descriptionString(node, parent) {
39
39
const content = node . children . map ( n => descriptionString ( n , node ) ) . join ( '' ) ;
40
40
if ( parent && parent . children . length === 1 ) return content ;
41
41
return '<p>' + content + '</p>\n' ;
42
+ } else if ( node . type === 'code' ) {
43
+ let classes = [ ] ;
44
+ let attrs = '' ;
45
+ if ( node . lang ) {
46
+ classes . push ( `language-${ node . lang } ` ) ;
47
+ }
48
+ if ( node . meta ) {
49
+ classes . push ( node . meta ) ;
50
+ }
51
+ if ( classes . length > 0 ) {
52
+ attrs = ` class="${ classes . join ( ' ' ) } "` ;
53
+ }
54
+ return `<pre><code${ attrs } >${ node . value } </code></pre>` ;
42
55
} else if ( node . type === 'inlineCode' ) {
43
56
return '<code>' + node . value + '</code>' ;
44
57
} else if ( node . type === 'list' ) {
You can’t perform that action at this time.
0 commit comments