Hi Ryan
Installation went fine, I did not have any problems whatsoever. Looks pretty good to me right now, did not have the chance to look at the code and at the set problem, but i guess this could be solved somehow by storing the settings files (sets) for each Markitup editor as text in an extension’s database tables. I’ll try to look into it some time soon.
One problem I had though was that the preview of markitup was not showing the text properly e.g. with no formatting, saving the entry into the database was fine and textile plugin displayed everything nicely.
Another thing I just spotted by quickly running through the code
$sysfolder = $PREFS->ini('system_folder');
...
<link rel="stylesheet" type="text/css" href="/'.$sysfolder.'/extensions/markitup/skins/markitup/style.css" />
...
This won’t work on production server with no domain assigned yet and a default subfolder like http://www.example.com/~client. The CSS will be included from www.example.com/ instead of www.example.com/~client/.
I’ve seen this in many extensions, the simple solution to this is not to include the files (js, css or whatever) from the “root /” plus system folder, but to include the site_url before the system folder. That way, the site_url setting in your CP will be taken into account.
$system = $PREFS->core_ini['site_url'].$PREFS->core_ini['system_folder'];
...
<link rel="stylesheet" type="text/css" href="'.$system.'/extensions/markitup/skins/markitup/style.css" />
...
Just a thought.
One problem I had though was that the preview of markitup was not showing the text properly e.g. with no formatting, saving the entry into the database was fine and textile plugin displayed everything nicely.
I do note on the Markitup page that the preview doesn’t currently work. You need to specify a preview parser path in each set.js file - and I hadn’t even toyed with that yet. It’s the second line down:
previewParserPath: '', // path to your Textile parser
I did also recommend just turning off the Preview. Note that I THINK the preview works for XHTML. You may only have to specify the path to the Textile plugin here…I’m not sure. If you experiment and find something out about it, I’d love to hear it.
Also, if anyone knows how to fix making multiple-line lists with one click (like you can in the Textile Editor Helper (that’s a different extension) I’d love to incorporate that - but it may just be a shortcoming of Markitup right now).
ADD: I will fix that System folder path issue, too. I know exactly what you mean. The way most exteensions are written that include files, they wouldn’t even work with a masked control panel. Thanks for pointing it out.
Awesome, many thanks for this, am testing it out on a new EE-site. Cheers! 😊 edit-add: works like a charm, this makes Markdown even easier to use for end users.
One tip: if you want to disable a button (say H1 and H2 are already are taken in your template), the easiest way is to set the display to none in the style.css file inside your set folder. For example: disabling the preview button… Change:
.markItUp .preview a {
background-image:url(images/preview.png);
}
to
.markItUp .preview a {
display: none;
}
This way you don’t have to mess around in the JS file.
Cried victory too soon I’m afraid. Markdown won’t render links and images properly. For example:
[Your text to link here...](http://www.apple.be "Apple website")
renders in HTML as:
<a href="http://a" title="http://www.apple.be">http://www.apple.be</a> "dsadadasdas">Your text to link here...</a>
In a non Markitup field set to formatting to Markdown I get the same error, which leads me to believe the Markdown plugin is doing something wrong… I’m baffled, any suggestions?
Cried victory too soon I’m afraid.Yes, DON’T cry victory too soon with this one. 😉 If you are getting the same error, I would assume it is due to the Markdown plugin itself. As I don’t use Markdown, I can’t speak to this. Any Markdown users know about this?
On a positive note, I tested the Textile version on the same site and that one works flawlessly. I posted a request for help with the Markdown plugin in the plugin forum as well.
If you are getting the same error, I would assume it is due to the Markdown plugin itself. As I don’t use Markdown, I can’t speak to this. Any Markdown users know about this?
Disabling Automatically turn URLs and email addresses into links? in CP Home › Admin › Weblog Administration › Weblog Management › Edit Weblog solves the Markdown problem. That one is sorted then 😊
For those still having trouble getting this to work - I was having the same problem and realized it was because I’m masking access to the control panel using /admin.php
It’s throwing off the path somehow. Try accessing your CP using the actual system folder like:
http://www.domain.com/system/
Hope that helps someone. If any figures out how to enable the preview please share!
P.S. This is one of the the most useful extensions out there. Great work!!!
Ok here’s how to set up the preview with markdown (should be similar for textile, others):
I created a file called ‘preview.php’ and placed it in the markitup root folder(system/extesions/markitup/preview.php). I also got a copy of markdown.php, and also put it in the markitup root.
Contents of preview.php:
<?php
include_once "markdown.php";
$my_text = $_POST['data']; //'data' is the default post variable markitup sends the data in.
$my_html = Markdown($my_text);
echo($my_html);
?>
Then in your ‘set’ file (system/extesions/markitup/sets/markdown/set.js) in the first few lines of code, add the previewParserPath and previewAutorefresh settings:
mySettings_markdown = {
previewParserPath:'~/preview.php',
previewAutorefresh: true,
onShi ...etc
previewAutorefresh is optional - but its pretty cool.
Feel free to add your stylesheets etc to the preview.php file. Have fun!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.