mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 07:32:59 +00:00 
			
		
		
		
	Improved wikitext docs
This commit is contained in:
		| @@ -3,7 +3,19 @@ title: $:/core/modules/parsers/newwikitextparser/rules/class.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text block rule for assigning classes to paragraphs and other blocks | Wiki text block rule for assigning classes to paragraphs and other blocks. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | {{myClass{ | ||||||
|  | This paragraph will have the CSS class `myClass`. | ||||||
|  |  | ||||||
|  | * The `<ul>` around this list will also have the class `myClass` | ||||||
|  | * List item 2 | ||||||
|  |  | ||||||
|  |  }}} | ||||||
|  | }}} | ||||||
|  |  | ||||||
|  | Note that the opening and closing braces both must be immediately followed by a newline. | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
| @@ -16,11 +28,11 @@ exports.name = "class"; | |||||||
|  |  | ||||||
| exports.blockParser = true; | exports.blockParser = true; | ||||||
|  |  | ||||||
| exports.regExpString = "\\{\\{(?:[^\\{\\r\\n]+)\\{$"; | exports.regExpString = "\\{\\{(?:[^\\{\\r\\n]+)\\{$\\r?\\n"; | ||||||
|  |  | ||||||
| exports.parse = function(match,isBlock) { | exports.parse = function(match,isBlock) { | ||||||
| 	var tree = [], | 	var tree = [], | ||||||
| 		reStart = /\{\{([^\{\r\n]+){(?:\r?\n)?/mg, | 		reStart = /\{\{([^\{\r\n]+){\r?\n/mg, | ||||||
| 		reEnd = /(\}\}\}$(?:\r?\n)?)/mg, | 		reEnd = /(\}\}\}$(?:\r?\n)?)/mg, | ||||||
| 		endMatch; | 		endMatch; | ||||||
| 	reStart.lastIndex = this.pos; | 	reStart.lastIndex = this.pos; | ||||||
|   | |||||||
| @@ -3,7 +3,15 @@ title: $:/core/modules/parsers/newwikitextparser/rules/codeblock.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for code blocks | Wiki text run rule for code blocks. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | 	{{{ | ||||||
|  | 	This text will not be //wikified// | ||||||
|  | 	}}} | ||||||
|  | }}} | ||||||
|  |  | ||||||
|  | Note that the opening curly braces and the closing curly braces must each be on a line of their own, and not be preceded or followed by white space. | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
| @@ -16,11 +24,11 @@ exports.name = "codeblock"; | |||||||
|  |  | ||||||
| exports.blockParser = true; | exports.blockParser = true; | ||||||
|  |  | ||||||
| exports.regExpString = "\\{\\{\\{\\s*\\r?\\n"; | exports.regExpString = "\\{\\{\\{\\r?\\n"; | ||||||
|  |  | ||||||
| exports.parse = function(match,isBlock) { | exports.parse = function(match,isBlock) { | ||||||
| 	this.pos = match.index + match[0].length; | 	this.pos = match.index + match[0].length; | ||||||
| 	var regExp = /(\r?\n\}\}\})/mg, | 	var regExp = /(\r?\n\}\}\}$)/mg, | ||||||
| 		text; | 		text; | ||||||
| 	regExp.lastIndex = this.pos; | 	regExp.lastIndex = this.pos; | ||||||
| 	match = regExp.exec(this.source); | 	match = regExp.exec(this.source); | ||||||
|   | |||||||
| @@ -3,7 +3,11 @@ title: $:/core/modules/parsers/newwikitextparser/rules/coderun.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for code runs | Wiki text run rule for code runs. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | 	This is a {{{code run}} and `so is this`. | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,15 @@ title: $:/core/modules/parsers/newwikitextparser/rules/dash.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for HTML entities | Wiki text run rule for HTML entities. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | This is an en-dash: -- | ||||||
|  |  | ||||||
|  | This is an em-dash: --- | ||||||
|  | }}} | ||||||
|  |  | ||||||
|  | Dashes must be followed by whitespace in order to be distinguished from strikethrough notation (`--strikethrough--`). | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
| @@ -20,7 +28,6 @@ exports.regExpString = "-{2,3}(?=\\s)"; | |||||||
|  |  | ||||||
| exports.parse = function(match,isBlock) { | exports.parse = function(match,isBlock) { | ||||||
| 	this.pos = match.index + match[0].length; | 	this.pos = match.index + match[0].length; | ||||||
| 	match = /(-{2,3})/mg.exec(match[0]); |  | ||||||
| 	var dash = match[0].length === 2 ? "–" : "—"; | 	var dash = match[0].length === 2 ? "–" : "—"; | ||||||
| 	return [$tw.Tree.Entity(dash)]; | 	return [$tw.Tree.Entity(dash)]; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -3,7 +3,21 @@ title: $:/core/modules/parsers/newwikitextparser/rules/emphasis.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for emphasis | Wiki text run rule for emphasis. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | 	This is ''bold'' text | ||||||
|  |  | ||||||
|  | 	This is //italic// text | ||||||
|  |  | ||||||
|  | 	This is __underlined__ text | ||||||
|  |  | ||||||
|  | 	This is ^^superscript^^ text | ||||||
|  |  | ||||||
|  | 	This is ~~subscript~~ text | ||||||
|  |  | ||||||
|  | 	This is --strikethrough-- text | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,11 @@ title: $:/core/modules/parsers/newwikitextparser/rules/entity.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for HTML entities | Wiki text run rule for HTML entities. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | 	This is a copyright symbol: © | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,13 @@ title: $:/core/modules/parsers/newwikitextparser/rules/extlink.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for external links. | Wiki text run rule for external links. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | An external link: http://www.tiddlywiki.com/ | ||||||
|  |  | ||||||
|  | A suppressed external link: ~http://www.tiddlyspace.com/ | ||||||
|  | }}} | ||||||
|  |  | ||||||
| External links can be suppressed by preceding them with `~`. | External links can be suppressed by preceding them with `~`. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,19 @@ title: $:/core/modules/parsers/newwikitextparser/rules/heading.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text block rule for headings | Wiki text block rule for headings. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | 	! Level one heading | ||||||
|  |  | ||||||
|  | 	A paragraph in level 1. | ||||||
|  |  | ||||||
|  | 	!! Level two heading | ||||||
|  |  | ||||||
|  | 	A paragraph in level 2. | ||||||
|  | }}} | ||||||
|  |  | ||||||
|  | The bang `!` must be the first thing on the line. Any white space before the text of the heading is ignored. | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
| @@ -20,6 +32,7 @@ exports.regExpString = "!{1,6}"; | |||||||
|  |  | ||||||
| exports.parse = function(match,isBlock) { | exports.parse = function(match,isBlock) { | ||||||
| 	this.pos = match.index + match[0].length; | 	this.pos = match.index + match[0].length; | ||||||
|  | 	this.skipWhitespace(); | ||||||
| 	var classedRun = this.parseClassedRun(/(\r?\n)/mg); | 	var classedRun = this.parseClassedRun(/(\r?\n)/mg); | ||||||
| 	return [$tw.Tree.Element("h1",{"class": classedRun["class"]},classedRun.tree)]; | 	return [$tw.Tree.Element("h1",{"class": classedRun["class"]},classedRun.tree)]; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -3,7 +3,13 @@ title: $:/core/modules/parsers/newwikitextparser/rules/html.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text block rule for block level HTML elements | Wiki text block rule for block and run level HTML elements. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | <aside> | ||||||
|  | This is an HTML5 aside element | ||||||
|  | </aside> | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,11 @@ title: $:/core/modules/parsers/newwikitextparser/rules/image.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for pretty links | Wiki text run rule for pretty links. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | [img[MyPicture]] | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,9 +3,33 @@ title: $:/core/modules/parsers/newwikitextparser/rules/list.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text block rule for lists. | Wiki text block rule for lists. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | * This is an unordered list | ||||||
|  | * It has two items | ||||||
|  |  | ||||||
|  | # This is a numbered list | ||||||
|  | ## With a subitem | ||||||
|  | # And a third item | ||||||
|  |  | ||||||
|  | ; This is a term that is being defined | ||||||
|  | : This is the definition of that term | ||||||
|  | }}} | ||||||
|  |  | ||||||
|  | Note that lists can be nested arbitrarily: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | #** One | ||||||
|  | #* Two | ||||||
|  | #** Three | ||||||
|  | #**** Four | ||||||
|  | #**# Five | ||||||
|  | #**## Six | ||||||
|  | ## Seven | ||||||
|  | ### Eight | ||||||
|  | ## Nine | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
| @@ -61,6 +85,8 @@ exports.parse = function(match,isBlock) { | |||||||
| 		} | 		} | ||||||
| 		// Skip the list markers | 		// Skip the list markers | ||||||
| 		this.pos = match.index + match[0].length; | 		this.pos = match.index + match[0].length; | ||||||
|  | 		// Skip any whitespace | ||||||
|  | 		this.skipWhitespace(); | ||||||
| 		// Process the body of the list item into the last list item | 		// Process the body of the list item into the last list item | ||||||
| 		var lastListInfo = listTypes[match[0].charAt(match[0].length-1)], | 		var lastListInfo = listTypes[match[0].charAt(match[0].length-1)], | ||||||
| 			lastListChildren = listStack[listStack.length-1].children, | 			lastListChildren = listStack[listStack.length-1].children, | ||||||
|   | |||||||
| @@ -3,7 +3,15 @@ title: $:/core/modules/parsers/newwikitextparser/rules/macro.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for pretty links | Wiki text run rule for pretty links. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | <<version>> | ||||||
|  |  | ||||||
|  | <<link to:HelloThere>< | ||||||
|  | A macro with a bunch of content inside it. The content can include //formatting//. | ||||||
|  | >> | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,13 @@ title: $:/core/modules/parsers/newwikitextparser/rules/prettylink.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for pretty links | Wiki text run rule for pretty links. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | [[Introduction]] | ||||||
|  |  | ||||||
|  | [[Link description|TiddlerTitle]] | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,11 @@ title: $:/core/modules/parsers/newwikitextparser/rules/rule.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text block rule for rules | Wiki text block rule for rules. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | --- | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,19 @@ title: $:/core/modules/parsers/newwikitextparser/rules/typedblock.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for typed blocks | Wiki text run rule for typed blocks. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | $$$.js | ||||||
|  | This will be rendered as JavaScript | ||||||
|  | $$$ | ||||||
|  |  | ||||||
|  | $$$.svg | ||||||
|  | <svg xmlns="http://www.w3.org/2000/svg" width="150" height="100"> | ||||||
|  |   <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> | ||||||
|  | </svg> | ||||||
|  | $$$ | ||||||
|  | }}} | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
| @@ -3,7 +3,15 @@ title: $:/core/modules/parsers/newwikitextparser/rules/wikilink.js | |||||||
| type: application/javascript | type: application/javascript | ||||||
| module-type: wikitextrule | module-type: wikitextrule | ||||||
|  |  | ||||||
| Wiki text run rule for wiki links. | Wiki text run rule for wiki links. For example: | ||||||
|  |  | ||||||
|  | {{{ | ||||||
|  | AWikiLink | ||||||
|  | AnotherLink | ||||||
|  | ~SuppressedLink | ||||||
|  | }}} | ||||||
|  |  | ||||||
|  | Precede a camel case word with `~` to prevent it from being recognised as a link. | ||||||
|  |  | ||||||
| \*/ | \*/ | ||||||
| (function(){ | (function(){ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston