mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 17:40:29 +00:00
552657fc58
This means that JavaScript and JSON tiddlers will be properly highlighted if the highlight plugin is loaded.
35 lines
794 B
JavaScript
35 lines
794 B
JavaScript
/*\
|
|
title: $:/core/modules/parsers/textparser.js
|
|
type: application/javascript
|
|
module-type: parser
|
|
|
|
The plain text parser processes blocks of source text into a degenerate parse tree consisting of a single text node
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
var TextParser = function(type,text,options) {
|
|
this.tree = [{
|
|
type: "element",
|
|
tag: "$codeblock",
|
|
attributes: {
|
|
code: {type: "string", value: text},
|
|
language: {type: "string", value: type}
|
|
}
|
|
}];
|
|
};
|
|
|
|
exports["text/plain"] = TextParser;
|
|
exports["text/x-tiddlywiki"] = TextParser;
|
|
exports["application/javascript"] = TextParser;
|
|
exports["application/json"] = TextParser;
|
|
exports["text/css"] = TextParser;
|
|
exports["application/x-tiddler-dictionary"] = TextParser;
|
|
|
|
})();
|
|
|