CMarkdown: no listings

I am using CMarkdown in Yii 1.1.15 and I am not happy with it. That’s what I did:

$text = "

 ## Headline A

 * listpoint 1

 * listpoint 2

here some text ...

 * listpoint 3

 * listpoint 4

 ## Headline B

 * listpoint 5

 * listpoint 6


    <?php $parser = new CMarkdownParser;

          echo $parser->safeTransform($text);


Listpoints 1+2+5+6 are ok: <ul><li>…

Listpoints 3+4 are only stars … that is bad

I didn’t find a way to solve the problem and only using the listings with a heading before is not userfriendly.

By the way, other things also don’t work: “--------” for a horizontal line. Who can help?

Googeling I couldn’t find others having my problems.

Is something wrong in my example above?

Or is there nearly noone who is using CMarkdown?

I do not use markdown, but when I test your markdown with Markdown Live Preview your markdown seems to be crooked.

Do the problems persist when you use transform() instead of safeTransform()? safeTransform adds HTMLPurifier filter.

I am sorry … the problems persist. Any other idea?

As you can see here the Yii parser works the same way as the original project. The problem with Markdown is it was not standardised from the beginning so many versions of it swarm the net (I think the official version and the standard is but I’m not sure).

I’m afraid you have to rearrange the text or find some other parser.

Thanx. I now made lot’s of tests and my result is, CMarkown is a poor implementation of Markdown. Lot’s of features do not work properly.

Is noone of you using CMarkdown or what do you do to to save formatted text into a database-table and then write it save into a view.

I thoght CMarkdown is an easy way to get rid of all XSS-Problems - with a small but often needed set of formatting features.

What do you do?

Personally, I prefer HtmlPurifier.

I was just thinking about HtmlPurifier as an alternative for CMardownParser.

Can I get happy with it?

My future needs are:

The first-priority need is to be XSS-Save: I want to use

  • some html-tags: div, h1-3, p, br, table, th, tr, td, span

  • put in pictures with img

  • format with css: <div class="xyz">

Will HtmlPurifier be the right way?

I use Imperavi Redactor as wysiwyg editor with HTMLPurifier to filter the user input.

I need it for a forum I am writing for my users. They only get text-input and for experienced users maybe some easy formating like CMarkdown-Parser - but maybe I need an alternative because it has problems. Maybe I must write an own parser in combination with HtmpPurifierer - I think that is not very difficult and time-consuming.

Only for my input I need a little more formating. I must trust Yii but I don’t want to trust and regularly update a foreign editor additionally. Therefore I must write my own text in html.

That should be xss-safe because I trust myself :slight_smile:

Otherwise - my input is laying in mysql and who knows what can happen. Therefore I will also filter my own input with HtmlPurifier.

Maybe you can get some inspiration for the forum extension.