GithubHelp home page GithubHelp logo

manifestuk / smartdown.craft-plugin Goto Github PK

View Code? Open in Web Editor NEW
26.0 2.0 1.0 501 KB

Bringing the unbridled joy of Markdown Extra and Smartypants to your Craft websites.

License: MIT License

PHP 100.00%
craft smartypants craftcms craft-plugin craftcms-plugin markdown

smartdown.craft-plugin's Introduction

Smartdown for Craft

Build Status

Smartdown for Craft is a Twig Filter which brings the unbridled joy of Markdown Extra and SmartyPants to Craft.

Craft already supports standard Markdown, but sadly standard Markdown doesn't support lots of useful things such as footnotes, fenced code blocks, and tables. It also does nothing to spruce up your typography, leaving your site with an embarrassment of straight quotes, and faux ellipses.

Smartdown plugs both of these gaps, turning your website into a typographic dreamboat.

Requirements

Each release of Smartdown is automatically tested against PHP 7.1 and above. It's also manually tested on the most recent version of Craft.

PHP 7.0 support

In theory, Smartdown should be compatible with PHP 7.0. In practise, it's impossible to test this, because the Codeception dependency tree includes components which only work with PHP 7.1+.

Unfortunately there's nothing we can do about that.

Installation

To install Smartdown, either search for "Smartdown" in the Craft Plugin Store, or add it as a Composer dependency.

Here's how to install Smartdown using Composer.

  1. Open your terminal, and navigate to your Craft project:

     cd /path/to/project
    
  2. Add Smartdown as a project dependency:

     composer require experience/smartdown
    
  3. In the Control Panel, go to "Settings โ†’ Plugins", and click the "Install" button for Smartdown

Basic usage

Use the Smartdown filter in exactly the same way as any other Twig filter.

{{ myVariable|smartdown }}

This will parse your content with both Markdown Extra, and SmartyPants, turning this:

"Outside of a dog, a book is a man's best friend. Inside a dog it's too dark to read..."

Into this:

"Outside of a dog, a book is a man's best friend. Inside a dog it's too dark to read..."

Filter parameters

markup

The markup filter parameter controls whether the text will be parsed using Markdown Extra. The default value is true.

Example usage:

{{ content|smartdown(markup=false) }}

typography

The typography filter parameter controls whether the text will be parsed using SmartyPants. The default value is true.

Example usage:

{{ content|smartdown(typography=false) }}

smartdown.craft-plugin's People

Contributors

monooso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ldennison-bsd

smartdown.craft-plugin's Issues

Composer was unable to install the updates due to a dependency conflict

Composer output: Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1

  • The requested package experience/smartdown 3.0.1 exists as experience/smartdown[3.0.0] but these are rejected by your constraint.

Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.


Any hint, please?

{{ entry | smartdown }} does not work

{{entry | smartdown}} displays nothing. {{entry.title | smartdown}} displays the smartdowned title.

As {{ entry }} displays the title of an entry I would expect {{entry | smartdown}} to work as well.

Smartdown is crashing Craft somehow??

FYI, i just tried enabling this on a brand-new, up-to-date Craft install. It made my entire site go 'down' when I tried to enable it, as in all admin and public pages render as empty white pages. Removing the Smartdown files from my plugin directory resolved the issue. I tried re-downloading and re-adding files back into the dir and the same thing happened. I've since tried installing other third party plugins... no problem.

Not sure if anyone else has run into this, as I've used this in the past without issues.

Missing file?

Trying this for the first time today. Immediately it generates an error:

include(/home/staging.ultrastopwindowfilms.co.uk/craft/plugins/smartdown/vendor/michelf/php-smartypants/Michelf/SmartyPants.php): failed to open stream: No such file or directory

However, the file above appears to be missing from the repository. Is this plugin no longer developed?

Thanks :)

PHP 7 .1 dependancy issue with composer.json default PHP version

When installing your plugin from the new store I ran into an error.

I'm running MAMP with PHP 7.1+ so meet your requirements but because in the root composer.json the config has php 7.0 by default, the installation will fail.

"config": {
    "optimize-autoloader": true,
    "platform": {
      "php": "7.0"
    }
  },

I just changed to "php": "7.1.0" which got me installed

Installing the plugin

Composer was unable to install the updates.

Error: An error occurred

Output: Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.


Error: An error occurred

Output: Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for experience/smartdown 3.0.0 -> satisfiable by experience/smartdown[3.0.0].
- experience/smartdown 3.0.0 requires php ^7.1.0 -> your PHP version (7.1.15) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.

Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.

Fatal error

Fatal error: Class 'Michelf\SmartyPants' not found in /path/to/craft/plugins/smartdown/SmartdownPlugin.php on line 106

I've installed/enabled the plugin in the latest version of Craft (2.6.2776), and am getting this result when trying to use the filter. PHP Version is 5.5.20

Update for Craft 3

Hello experience,
will you make this available for Craft3 soon?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.