Hi Danielo

Apologies, I missed your original post.

It sounds like you are dividing the displayed text up into lines and then
want to independently apply syntax highlighting to each line.

I wouldn't have expected that to work because of the problem you found with
multiline comments.

I don't think there's much choice but to highlight the entire codeblock
first, and then do your processing to convert it into individual lines.

Now that your hacking on highlight.js it may be useful to engage with the
author and find out if there's a recommended approach for what you're
trying to achieve.

Best wishes

Jeremy



On Sat, Nov 15, 2014 at 6:16 PM, Danielo Rodríguez <[email protected]>
wrote:

> Maybe an screenshot of what I'm working on motivates people to help me a
> bit :P
>
>
> <https://lh3.googleusercontent.com/-QYIvGL3Z1yk/VGeYC6JERPI/AAAAAAAALl4/h89RjAG2atE/s1600/Captura%2Bde%2Bpantalla%2B2014-11-15%2Ba%2Bla%28s%29%2B19.11.23.png>
>
> There is: zebra strip, hidden lines, line numbers, line highlighted
> on-hover, lines marked (strong yellow). The only problem? the hljs library
> does not understand multi line comments because they are splited on several
> domNodes.
>
> Does anyone have a suggestion?
>
> El domingo, 9 de noviembre de 2014 17:33:22 UTC+1, Danielo Rodríguez
> escribió:
>
>> Hello
>>
>> I started developing a plugin for a personal project. It is getting
>> mature and rich in features and I'm thinking in releasing a version for
>> everyone use. But for do this I have to solve a problem I don't even know
>> how to start with.
>>
>> The plugin provides some extra features for code block. It uses
>> highlight.js to provide syntax highlighting. In my use case all sentences
>> are single line, so first I split the text in lines, then I highlight each
>> line separately and then I  add each line inside a wrapper node. This is a
>> problem for other situations like comment blocks. I thought about
>> highlighting the whole code block and after that splitting it in lines. The
>> problem is the result code block is a collection of DOM nodes and I'm not
>> sure of the best way for iterating over it. Should I take it as a big
>> string and parse each span or should I iterate over the different DOM
>> nodes? In the second case, what is the best approach? If a node contains
>> line breaks clone it as many times as line breaks it contains and delete
>> the necessary text on each one? I'm totally lost.
>>
>> Thank for any help.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" 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/tiddlywikidev.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to