1 of 4
1
Markdown and Smarty Pants
Posted: 03 October 2006 02:19 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Here’s a simple plugin to allow both Markdown formatting and SmartyPants rendering in one plugin.  You’ll have to install this plugin and the two Gruber files here:

http://expressionengine.com/downloads/details/markdown/
http://expressionengine.com/downloads/details/smartypants/

Enjoy.

File Attachments
pi.markypants.zip  (File Size: 2KB - Downloads: 222)
 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 October 2006 02:50 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  745
Joined  08-16-2003

I’m not sure I understand how this is different from EE’s built-in ability to use plugins for default text formatting. Can you clarify?

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 03 October 2006 03:11 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Wow, all this time adding/removing and editing fields and I never saw/bothered to look under that link.  Huh, pretty cool.  Thanks for pointing this out.  Do you know if anyone has written a Markdown or Smarty format?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 October 2006 03:14 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

If you install the markdown/smarty plugins (plugins.pmachine.com) - they should show up in that list.  I am pretty sure these plugins exist. =)

 Signature 
Profile
MSG
 
 
Posted: 03 October 2006 03:20 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

huh.  Thanks a lot!

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 October 2006 03:24 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Ok. so i got them installed.  Now is there any way to use both Markdown and Smarty at the same time?  Being a drop down list you can only choose one format.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 October 2006 03:34 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  745
Joined  08-16-2003

Lisa probably knows for sure, but I think you’d have to merge the plugins into the mutant Smartdown to achieve that.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 03 October 2006 03:34 PM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  31280
Joined  05-14-2004

Not that I’m aware of, short of merging them into one plugin.

 Signature 
Profile
MSG
 
 
Posted: 03 October 2006 03:58 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15006
Joined  06-03-2002
Mr. Wilson - 03 October 2006 03:34 PM

Lisa probably knows for sure, but I think you’d have to merge the plugins into the mutant Smartdown to achieve that.

If I were doing it, it would be Markypants.

 Signature 
Profile
MSG
 
 
Posted: 03 October 2006 04:04 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  745
Joined  08-16-2003

If I were doing it, it would be Markypants.

shock

Image Attachments
markypants.jpg
Click thumbnail to see full-size image
 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 03 October 2006 04:11 PM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

hehehe.  Markypants.  hehe.

So, what do you think is a better solution.  A combined “Markypants” or an extension that alters the XHTML formatting to include both?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 October 2006 04:28 PM   [ Ignore ]   [ # 11 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15006
Joined  06-03-2002
markhuot - 03 October 2006 04:11 PM

hehehe.  Markypants.  hehe.

So, what do you think is a better solution.  A combined “Markypants” or an extension that alters the XHTML formatting to include both?

I’d prefer a plugin myself, as you don’t necessarily want *everything* that’s run through XHTML typography to be handled by these formatting plugins.  What if another plugin, extension, or module utilizes the core typography parsing and expects certain input and output?  And keep in mind that in either scenario, you can call plugins from within a plugin, so you won’t need to duplicate any code, but merely require that the other plugins are installed.  Should either of those plugins change, that will also mean that you won’t have to duplicate those changes in your own solution.

 Signature 
Profile
MSG
 
 
Posted: 03 October 2006 04:31 PM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Ahh, well.  Off to work I go then.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 04 October 2006 03:18 AM   [ Ignore ]   [ # 13 ]  
Research Assistant
RankRankRank
Total Posts:  543
Joined  01-05-2005

what would be good is an extension that adds markdown to the “Default Text Formatting for This Field” dropdown when adding custom fields.

I always use markdown for large textareas and it’s a little frustrating that you can’t add markdown (or any others) to the list unless you’re editing the field. 

I’ve always had to create the custom field with xhtml as the formatting, save it, go back in to edit it, click the link to edit the list, choose markdown, and then remember to click the checkbox at the bottom, and save.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 04 October 2006 07:11 AM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

I’ve tried combining the two however when I choose MarkyPants from the formatting drop down and try to publish a link it seems to get converted twice (once by Markdown and once by EE’s internal formatting).  Because of that I get links like this:

<a href="a href="http://localhost/bus/trunk/ee142p/index.php?URL=http://example.net/" target="_blank" >http://example.net/</a">This link</a>

It seems that MarkyPants is creating the link and then EE is converting the link again inside of the Markdown link.  Is there any way to turn off EE’s ability to convert links from within my plugin?

Thanks

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 04 October 2006 08:15 AM   [ Ignore ]   [ # 15 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

ok.  so a quick fix?  I just strip out all the tags before markdown runs.  does this sound like it will break something?

$str = preg_replace("/<.*?>(.*?)<\/.*?>/", "$1", $str);

I would much rather figure out how to make EE stop converting links.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 04 October 2006 08:46 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
RankRankRank
Total Posts:  543
Joined  01-05-2005

Not sure how to do it from within your plugin, but is it no good doing it in the weblog preferences?  “Automatically turn URLs and email addresses into links? yes/no “.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 04 October 2006 03:53 PM   [ Ignore ]   [ # 17 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Ok.  That seems to work well (turning it off in the Weblog’s individual preferences) so I have for everyone a revised “MarkyPants” plugin.  Enjoy!  And don’t forget it requires the Markdown and SmartyPants plugins to be installed also.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 05 October 2006 01:01 AM   [ Ignore ]   [ # 18 ]  
Research Assistant
RankRankRank
Total Posts:  543
Joined  01-05-2005

mark, I’m getting this error after setting a field formatting as markypants.  markdown, smartypants, and markypants are installed.

Fatal error: Cannot redeclare identify_modifier_markdown() (previously declared in C:\dev\myproject\myadmin\plugins\pi.markdown.php:241) in C:\dev\myproject\myadmin\plugins\pi.markdown.php on line 252

did you mean that Markdown and SmartyPants should be uninstalled?

 Signature 

Celebrating again soon.

Profile
 
 
   
1 of 4
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 61050 Total Logged-in Users: 21
Total Topics: 73855 Total Anonymous Users: 7
Total Replies: 398372 Total Guests: 477
Total Posts: 472227    
Members ( View Memberlist )