1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-08-26 03:26:45 +00:00
TiddlyWiki5/core/modules/parsers/newwikitextparser/blockrules/heading.js
Jeremy Ruston 49a3cb8ede Allow for macros and classes at both run level and block level
Involving a bit of a refactoring of the parameters to the
$tw.Tree.Macro constructor
2012-05-28 15:51:52 +01:00

28 lines
579 B
JavaScript

/*\
title: $:/core/modules/parsers/newwikitextparser/blockrules/heading.js
type: application/javascript
module-type: wikitextrule
Wiki text block rule for headings
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "heading";
exports.blockParser = true;
exports.regExpString = "!{1,6}";
exports.parse = function(match,isBlock) {
this.pos = match.index + match[0].length;
var classedRun = this.parseClassedRun(/(\r?\n)/mg);
return [$tw.Tree.Element("h1",{"class": classedRun["class"]},classedRun.tree)];
};
})();