Hi Reece

> I'm working on a macro currently that displays the contents of a field as 
> markdown text that "Picks up" hard line breaks.
> 
> From the documentation on hard line breaks, the site shows that you can 
> enclose text with triple quotes for it to capture:
> 
> """
> Some
> short lines
> together
> """
> 

The hard line break support in TW5 is implemented as a parser rule that 
replaces line breaks with <br> tags. So the above example is exactly equivalent 
to typing:

Some<br/>
short lines<br/>
together

> This renders as "Some short lines together" as expected. In my case I'm 
> utilizing an $edit-text widget to edit a field that is NOT the text field so 
> that the data can all be retained in a single tiddler. From the $edit-text my 
> "skill" field can be edited with hard line breaks but I still have to wrap 
> the selection with triple quotes to get it to render as I want. 
> 
> Is there any way to pass the need for the triple quotes into a macro? I would 
> like to not have to perform this manual edit when attempting to get line 
> breaks as I expect. Ideally I would like to call <<con-display "skill">> and 
> have the text render with the hard line breaks from any field, instead of 
> quoting out every field. Is this possible?
> 
> I've tried a few variations on placing the quotes outside/inside the wikify 
> and I have yet to figure it out.

Here’s one way of approaching it. Given a toddler “New Tiddler” containing the 
text above (without the triple double quotes):

<$wikify name="output" output="html" text={{{ [[New 
Tiddler]get[text]addprefix["""]addsuffix["""]] }}}>
<<output>>
</$wikify>

The disadvantage of this approach is that by using the wikify widget we 
“flatten” the contents of the field to plain HTML. So you won’t be able to 
include TW features that don’t exist in HTML (eg reveal or list widgets).

Best wishes

Jeremy.


> 
> \define con-display-block($field$)
> <$wikify type="text/x-markdown" output="html" mode="block">
> 
> {{!!$field$}}
> 
> </$wikify>
> \end
> 
> 
> 
> Thanks,
> 
> -Reece
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/tiddlywiki 
> <https://groups.google.com/group/tiddlywiki>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/b8574cab-6469-417c-976a-3a09e2279162%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/b8574cab-6469-417c-976a-3a09e2279162%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4D1AC7ED-0A2F-4AE0-8026-0500E522F927%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to