Hi Sid,

Create a tiddler, tagged with $:/tags/Macro, containing:

\define c(text)
@@color: #f00;
@@padding: .5em;
$text$
@@
\end

Note: There must be a newline after \end

Save and reload.

You can now use the macro as:

<<c "Hello World">>

Hope that helps.

Cheers,

Ton


On Friday, August 1, 2014 7:02:42 PM UTC+2, Sid Thakur wrote:
>
> Hi,
> Thanks for the clarification.
>
> One more thing, I would like to create custom macros to apply custom 
> style. For example, following response from this question 
> <https://groups.google.com/d/msg/tiddlywiki/Io18xFXE7s0/HtjjHjQa8fQJ> 
> explains an alternative to creating custom style macros
>
> HOWEVER... there is another method using *built-in* TiddlyWiki syntax 
>> that would probably achieve your goals in the quickest, simplest way 
>> possible: just define some alternative *abbreviated* classnames in 
>> your StyleSheet, like this: 
>> .review-question, .rq { ... your CSS here ... } 
>> Then, you can just write: 
>> {{rq{fire}}} 
>> in your tiddler content. Enter code here...
>>
> I would like to achieve the effect of <span style="color: #f00; padding: 
> .5em;">Hello World</span>' using a short, re-usable macro.
>
> Thus, how can I develop the custom styling macro with the styling syntax 
> ('@@.foo text @@') that you mentioned, or is there another way?
>
> Thanks for your time.
> Sid
> ---
>
> On Friday, August 1, 2014 12:32:23 PM UTC-4, Ton Gerner wrote:
>>
>> Hi Sid,
>>
>> Styling in TW5 is different from TWC.
>>
>> Use
>>
>> @@.foo
>> Hello World
>> @@
>>
>> For more info see [1]
>>
>> Cheers,
>>
>> Ton
>>
>> [1] 
>> http://tiddlywiki.com/#Styles%20and%20Classes%20in%20WikiText:[[Styles%20and%20Classes%20in%20WikiText]]
>>
>> On Friday, August 1, 2014 5:30:11 PM UTC+2, Sid Thakur wrote:
>>>
>>> Hi,
>>> I'm having trouble with applying class in custom css in TiddlyWiki5.
>>> - I created a Tiddler with tag "$:/tags/stylesheet" and added following 
>>> to it
>>>
>>> .foo {
>>> color: #f92;
>>> background-color: #ffc;
>>> }
>>> - I create a new tiddler and want to use the class 'foo'. I add to the new 
>>> tiddler following:
>>> {{foo{Hello World}}}
>>>
>>> However, I only see {{foo{Hello World}}} and not 'Hello World' with .foo's 
>>> style applied to it.
>>> What's going on, am I missing something?
>>> Thanks
>>> Sid
>>> ---
>>>
>>>
>>>
>>> On Sunday, January 19, 2014 4:55:36 AM UTC-5, Eric Shulman wrote:
>>>>
>>>> On Saturday, January 18, 2014 10:27:47 PM UTC-8, JeffOnWire wrote:
>>>>>
>>>>> I'm trying to apply custom styles to my TiddlyWiki 5.0.3-beta. I think 
>>>>> there is a "ShadowTiddler" called "StyleSheet" that I can override by 
>>>>> creating a tiddler (that's just a blog entry right? Created by clicking 
>>>>> the 
>>>>> "+"?). I've created one, but it doesn't seem to be working and so I'm not 
>>>>> at all sure that I'm doing any of it correctly.
>>>>>
>>>>
>>>> In TiddlyWiki Classic (TWC), custom CSS is added by placing it in a 
>>>> special tiddler named "StyleSheet".
>>>> In TiddlyWiki 5 (TW5), custom CSS is added by placing it in a tiddler 
>>>> tagged with "$:/tags/stylesheet".
>>>>
>>>> enjoy,
>>>> -e
>>>> Eric Shulman
>>>> TiddlyTools / ELS Design Studios
>>>>
>>>> EVERY DONATION IS IMPORTANT!
>>>> HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
>>>>    http://TiddlyTools.github.com/fundraising.html#MakeADonation
>>>>
>>>> Professional TiddlyWiki Consulting Services...
>>>> Analysis, Design, and Custom Solutions:
>>>>    http://www.TiddlyTools.com/#Contact
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to