2012-04-05 8 views
0

Ich habe in den letzten paar Stunden durch den Quellcode für Reddit (https://github.com/reddit/reddit/wiki) gestoßen und ich kann was nicht finden Ich bin auf der Suche nach: Die Funktion, die die Flat-to-HTML-Konvertierung für ihre Kommentare ausführt.Text zu HTML-String Parsing a la Reddit Kommentare

Wenn Sie nicht vertraut sind, auf der Seite hat es eine Tabelle, die zeigt, wie Sie Ihren Kommentar zu formatieren und konvertiert Ihren Klartext in HTML für Links, fett, kursiv etc.

-Link:http://www.reddit.com/r/technology/comments/rupkj/5000_artists_line_up_for_a_pirate_bay_promotion/c48sy1v(Hit "antworten", dann "Formatierungshilfe" die Tabelle der Formatierungsoptionen zu sehen.)

Probeneingang:

This should be: **bold** and **I'm also bold** 

This should be: *italic* and *I'm italic too* 

This should be: ~~strikethrough text~~ 

This should be: [A Link To Google.com](http://www.google.com) 

This should be A list: 
*This is a list 
*Of differnet 
*Things that I like 

Irgendeine Idee wie man das elegant mit Regex erreichen kann?

+2

Suchen Sie nach einem [Markdown] (http://daringfireball.net/projects/markdown/) Parser? – Qtax

+0

Ich war sicher !!!! Das ist genau was ich gesucht habe. Danke Qtax! – NotJustClarkKent

+0

Qtax, kannst du das als Antwort nehmen, damit ich dir Karma geben kann? :) – NotJustClarkKent

Antwort

1

Wie in den Kommentaren gesagt, suchen Sie wahrscheinlich nach .