|
<?xml version="1.0" encoding="UTF-8"?> |
|
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Sun Dec 15 2019 07:41:59 GMT-0500 (Eastern Standard Time)--> |
|
<XholonWorkbook> |
|
|
|
<Notes><![CDATA[ |
|
Xholon |
|
------ |
|
Title: Markdown - Showdown |
|
Description: |
|
Url: http://www.primordion.com/Xholon/gwt/ |
|
InternalName: 66f5d5f1d14a5c9e8f905d13839e35aa |
|
Keywords: |
|
|
|
My Notes |
|
-------- |
|
December 14, 2019 |
|
|
|
http://127.0.0.1:8888/wb/editwb.html?app=Markdown+-+Showdown&src=lstr |
|
http://127.0.0.1:8888/Xholon.html?app=Markdown - Showdown&src=lstr&gui=clsc&jslib=showdown.min |
|
|
|
TODO |
|
- DONE edit war/editwb.html |
|
- DONE add <div id="xhedmd" style="display:block;"></div> |
|
|
|
To convert xhedmd content to html: |
|
---------- |
|
var $doc = document; |
|
var converter = new showdown.Converter(); |
|
var mddiv = $doc.querySelector("div#xhedmd"); |
|
var md = ... |
|
var html = converter.makeHtml(md); |
|
|
|
// this might work |
|
var ta = document.querySelector("div#xhedmd > textarea"); |
|
var anEditor = CodeMirror.fromTextArea(ta); |
|
var xmlString = anEditor.getValue(); |
|
|
|
// get content of MD <_-.XholonClass/> this works! BUT it makes a second textarea visible |
|
var $doc = document; |
|
var ta = $doc.querySelector("div#xhedmd > textarea"); |
|
var anEditor = CodeMirror.fromTextArea(ta); // this line makes the textarea duplicate itself on the screen |
|
var str = anEditor.getValue(); |
|
console.log(str); |
|
var converter = new showdown.Converter(); |
|
var html = converter.makeHtml(str); |
|
console.log(html); |
|
|
|
**testing** |
|
|
|
References |
|
---------- |
|
(1) http://showdownjs.com |
|
Showdown |
|
A Markdown to HTML bidirectional converter written in Javascript! |
|
|
|
(2) https://github.com/showdownjs/showdown |
|
|
|
(3) https://www.npmjs.com/package/showdown |
|
|
|
(4) http://demo.showdownjs.com/ |
|
|
|
(5) https://markdowntohtml.com |
|
|
|
]]></Notes> |
|
|
|
<markdown><![CDATA[ |
|
**one** |
|
*two* |
|
# Three |
|
## Four |
|
|
|
> something |
|
|
|
Five |
|
---- |
|
seven |
|
eight |
|
nine |
|
six |
|
ten |
|
|
|
1. un |
|
2. deux |
|
|
|
* Unordered lists, and: |
|
1. One |
|
1. Two |
|
1. Three |
|
* More |
|
|
|
ending |
|
------ |
|
the end |
|
endier |
|
|
|
]]></markdown> |
|
|
|
<_-.XholonClass> |
|
|
|
<!-- domain objects TEST --> |
|
<PhysicalSystem/> |
|
<Block/> |
|
<Brick/> |
|
|
|
<!-- quantities --> |
|
<Height superClass="Quantity"/> |
|
|
|
</_-.XholonClass> |
|
|
|
<xholonClassDetails> |
|
<Block> |
|
<port name="height" connector="Height"/> |
|
</Block> |
|
</xholonClassDetails> |
|
|
|
<PhysicalSystem> |
|
<Block> |
|
<Height>0.2 m</Height> |
|
</Block> |
|
<Brick multiplicity="2"/> |
|
</PhysicalSystem> |
|
|
|
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ |
|
var a = 123; |
|
var b = 456; |
|
var c = a * b; |
|
if (console) { |
|
console.log(c); |
|
} |
|
//# sourceURL=Blockbehavior.js |
|
]]></Blockbehavior> |
|
|
|
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ |
|
var myHeight, testing; |
|
var beh = { |
|
postConfigure: function() { |
|
testing = Math.floor(Math.random() * 10); |
|
myHeight = this.cnode.parent(); |
|
}, |
|
act: function() { |
|
myHeight.println(this.toString()); |
|
}, |
|
toString: function() { |
|
return "testing:" + testing; |
|
} |
|
} |
|
//# sourceURL=Heightbehavior.js |
|
]]></Heightbehavior> |
|
|
|
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ |
|
$wnd.xh.Brickbehavior = function Brickbehavior() {} |
|
|
|
$wnd.xh.Brickbehavior.prototype.postConfigure = function() { |
|
this.brick = this.cnode.parent(); |
|
this.iam = " red brick"; |
|
}; |
|
|
|
$wnd.xh.Brickbehavior.prototype.act = function() { |
|
this.brick.println("I am a" + this.iam); |
|
}; |
|
//# sourceURL=Brickbehavior.js |
|
]]></Brickbehavior> |
|
|
|
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ |
|
console.log("I'm another brick behavior"); |
|
]]></Brickbehavior> |
|
|
|
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, |
|
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> |
|
<g> |
|
<title>Block</title> |
|
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/> |
|
<g> |
|
<title>Height</title> |
|
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/> |
|
</g> |
|
</g> |
|
</svg> |
|
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> |
|
|
|
</XholonWorkbook> |