README.md
1# Webcode component (Render HTML, Javascript and CSS)
2
3## Usage
4
5The [Webcode component](https://combostrap.com/webcode) renders the output of:
6
7 * CSS
8 * HTML
9 * [Javascript](#javascript) or [Babel](#babel)
10 * Dokuwiki
11
12code block.
13
14By enclosing code block by a `<webcode>` block, the plugin will add the result after the last webcode tag.
15
16See the [webcode documentation](https://combostrap.com/webcode)
17
18## Example
19
20See the plugin in action [here](https://combostrap.com/webcode).
21
22## Illustration
23
24![The illustration](images/webcode_plugin_illustration.png "Webcode Illustration")
25
26## Installation
27
28Install the plugin using:
29
30 * the [Plugin Manager](https://www.dokuwiki.org/plugin:plugin)
31 * [manually](https://www.dokuwiki.org/plugin:Plugins) with the [download URL](http://github.com/gerardnico/dokuwiki-plugin-webcode/zipball/master), which points to latest version of the plugin.
32
33
34
35## Road map
36
37 * Allow Runkit (This [code](https://gerardnico.com/web/javascript/node/script#browser) works on JsFiddle but not in webcode ) may be cause by the restrictions. See below.
38```html
39<iframe name="result" allow="midi *; geolocation *; microphone *; camera *; encrypted-media *;"
40sandbox="allow-modals allow-forms allow-scripts allow-same-origin allow-popups allow-top-navigation-by-user-activation" allowfullscreen="" allowpaymentrequest="" frameborder="0" src="">
41 </iframe>
42```
43 * More language with:
44 * [sphere-engine](https://developer.sphere-engine.com/api/compilers) - Online example: https://ideone.com
45 * or [codingground](https://www.tutorialspoint.com/codingground.htm
46 * [Glot.io](https://github.com/prasmussen/glot)
47 * [Mermaid Graph Library](https://mermaidjs.github.io) as language
48 * Add the console after initial rendering to not select console element via css
49
50## Technically
51
52Technically, the plugin:
53
54 * parses the content between the two `<webcode>` tag,
55 * extracts the html, css and javascript code,
56 * adds after the last webcode tag an [iframe](https://docs.webplatform.org/wiki/html/elements/iframe),
57 * and a button that permits to play with the code on [JsFiddle](https://jsfiddle.net)
58
59
60## Changes
61
62### 2021-02-02
63
64 * The bar (`rendered by` and `Try the code`) are now less prominent and follows the [prism style](https://prismjs.com/plugins/toolbar/)
65 * The documentation has moved to ComboStrap.
66
67### 2020-05-27
68
69 * Added the possibility to show dokuwiki code if the language extension is dw
70 * Bug: the babel term was replaced by Javascript also in the code. It should be only on the code definition.
71 * Bug: trElement was declared two times in two different scope causing problem
72 * Added the possibility to cache a code block
73 * Webcode has been restructured (with the use of addPattern) and can now wrap headers (level, section). It can then be used for a howto page.
74 * Automatic test and travis has been added
75
76### 2019-05-14
77
78 * Firebug console was not added when the language was Babel
79 * The output on the console log is now escaped for HTML entities and can then render HTML
80 * There was a bug with the declaration of a variable
81
82### 2019-02-06
83
84 * To be able to see the output of a `console.log` javascript statement in JsFiddle, the firebug resources have been added (The JsFiddle feature was broken)
85 * New publication date on Dokuwiki
86
87### 2017-10-22
88
89 * Added a `renderingMode` argument to be able to show only the result
90 * Added a promotion link
91 * The links are now after the result.
92### 2017-08-05
93
94 * The 'console.table' function is partially supported
95 * The 's' variable leaked from the window.console.log function of the webCodeConsole.js
96
97### 2017-06-07
98
99 * The height of the Iframe is now dynamically calculated. No need to give this attribute anymore if you want to see the whole output.
100
101### 2017-04-28
102
103 * Added [Babel](https://babeljs.io/) support
104 * Bugs (Https call to Fiddle in place of Http, externalAttributes Resources in the action bar in place of include, Xml was not replaced by HTML code)
105 * Cache bursting implementation for the weCodeConsole.(js|css) file so that they are not cached for an new version.
106 * New lines (\n) are now supported in the javascript console.log function.
107 * Object of one level are now supported in the javascript console.log function.
108 * [JSFiddle bug 726](https://github.com/jsfiddle/jsfiddle-issues/issues/726) makes the resources order not consistent. Solution: More than one resources will be then added in the HTML script element.
109### 2017-10-1
110 * Two block of the same code are now concatenated
111 * Jquery is no more used. It was used for the javascript part of the console functionality.
112 * XML is now seen as HTML
113 * The ''name''
114