-
Notifications
You must be signed in to change notification settings - Fork 4
Rulers: Methods
Alteras1 edited this page Jun 24, 2020
·
13 revisions
Methods determine how a tag get processed into HTML. Only certain methods works with other, and some with the proper ruler type. In general, method returns either a string of a HTML element (done in CSS naming scheme; see wrap) or is a function that returns a token
. Here is a list of the ones we're aware of:
- wrap
- replace
- before
- after
See Structure of a Ruler for how to make a Ruler
For the simple way of doing methods, see wrap. Anyway, functions are a complex way of
wrap
is the simplest method. Here is an example:
md.inline.bbcode.ruler.push("highlight", {
tag: "highlight",
wrap: "span.bbcodeHighlight"
});
Here [highlight]text[/highlight]
becomes <span class="bbcodeHighlight">text</span>
.
wrap
in this use case is extremely simple, but not very useful. Here is a use case where it take an argument.
sfadsf