Thanks for the help, Conrad! I ended up doing what you suggested by 
splitting the string and using List.map to format each word. 

On Sunday, July 17, 2016 at 8:06:00 AM UTC-7, Conrad Dean wrote:
>
> If you want to dynamically parse out @usernames from input, I think you'll 
> need to write a function that annotates the user's input  and wraps text in 
> Html.b nodes, so something that would turn a 
>
> String "I heard @john likes apples"
>
> into 
>
> Html.span [] [
>    Html.text "I heard ", 
>   (Html.b [] [Html.text "@john "]), 
>    Html.text "likes apples"
> ]
>
> Using a regex to replace "... @john ..." with "... <b>@john</b> ..." will 
> faithfully update the textual content and show the html tags to users in 
> the browser because Elm by default won't let you inject raw markup because 
> it's an unsafe thing to do.  Instead you need to explicitly create those 
> Html objects.
>
> On Sun, Jul 17, 2016 at 9:51 AM, Rex van der Spuy <dandy...@gmail.com 
> <javascript:>> wrote:
>
>> Hi, what's the bigger picture that you're trying to accomplish?
>> Have you looked at Elm's Markdown package?
>>
>> http://package.elm-lang.org/packages/evancz/elm-markdown/3.0.0/
>>
>> Markdown will format any words surrounded by double asterisks as bold 
>> text, like this: **this is bold**
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elm-discuss...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to