Markdownfield - Markdown field for SilverStripe

Overview

MarkdownField

CircleCI codecov

This module introduces a new DB field type Markdown & Markdown Editor. It uses github style Markdown style. And uses the simple markdown editor.

https://github.com/sparksuite/simplemde-markdown-editor

https://github.com/cebe/markdown

The module is still under development, but soon will be ready, with link popups and image selectors.

Installation

Use composer

composer require silverstripers/markdown dev-master

Basic Usage

To use the markdown DB field in your data objects the basic code would look like


class MyDataClass extends DataObject
{

    private static $db = [
		'MarkdownContent'		=> 'MarkdownText'
	];

}

MarkdownText knows to add a markdown editor for your fields, but if you need to manually specify the type of field use

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab('Root.Sidebar', [
        \SilverStripers\markdown\forms\MarkdownEditorField::create('MarkdownContent', 'Content'),
    ]);

    return $fields;
}

Force all the fields to use Markdown

If you are looking to replace all the fields of HTMLText to markdown use the following configs in the config.yml.

This should override any instances of the HTMLText replacements with MarkdownText

---
Name: myconfigs
After:
  - '#corefieldtypes'
---
SilverStripe\Core\Injector\Injector:
  HTMLText:
    class: SilverStripers\markdown\db\MarkdownText

Add preview styles

You can add your own CSS styles to the editor previews. This would let the users to check how their content will be displayed before they save in.

To achived this create a css file in mysite/css/ and name it as editor.css.

Your CSS rules have to be nested in a class so it wont affect other areas of the CMS.

.markdown-preview {
    background-color: white;
    padding: 20px;
    font-size: 20px;
}

.markdown-preview h1 {
    font-size: 30px;
}

If you are using a separate config and wanting to add styles to that EditorConfig you just add a new class name. This is possible because the fields adds the EditorConfig's identifier on to the preview pane. The below is an example for the default configs.

.markdown-preview.default {
    background-color: white;
    padding: 20px;
    font-size: 14px;
    line-height: 20px;
}

.markdown-preview.default h1 {
    font-size: 24px;
    line-height: 30px;
}
Comments
  • Initial setup with suggested CircleCI config

    Initial setup with suggested CircleCI config

    Added a test for the primary DB field

    Added some configuration for scrutinizer/CircleCI (which I personally prefer, but it's up to you of course!), CodeCov and CodeClimate.

    opened by Firesphere 6
  • I'm running in to the error below, any clue?

    I'm running in to the error below, any clue?

    I have enabled to have Content always be a MarkDown Field, and get this error (I will investigate further later on, not really have time right now.)

    Call to a member function getAttributes() on string in /vagrant/website/vendor/silverstripers/silverstripe-markdown/src/forms/MarkdownEditorField.php on line 64

    opened by Firesphere 3
  • Don't use FQN for the DB field name

    Don't use FQN for the DB field name

    you can use MarkdownText in $db array rather than \SilverStripers\markdown\db\MarkdownText

    eg:

    private static $db = array(
        'MarkdownContent'		=> 'MarkdownText'
    );
    
    opened by priyashantha 2
  • added a new check for the markdown buttons to check dependency module…

    added a new check for the markdown buttons to check dependency module…

    added a new check for the markdown buttons to check dependency modules within the YML configs, updated the JS to check whether the asset-admin module is installed.

    This fixes the issue reported on here. https://github.com/SilverStripers/markdownfield/pull/21

    opened by fonsekaean 0
  • change the HTMLText's class from injector to point to MarkdownText

    change the HTMLText's class from injector to point to MarkdownText

    This is another way to change the HTMLText class's pointer directoly to markdown. So any other modules which uses HTMLText will be converted to Markdown.

    @Firesphere @priyashantha can you take a look at this one please.

    opened by fonsekaean 0
  • Minor code cleanups and removal of duplicate code or unused code.

    Minor code cleanups and removal of duplicate code or unused code.

    • Removed unneeded/unused code
    • Added docblocks to methods
    • Added use statements instead of using inline FQN
    • Ran PHP-CS-Fixer to make it PSR-2 compliant
    • Changed all arrays to shorthand (preferred syntax, and more consistent over all)
    opened by Firesphere 0
  • Added standard Scrutinizer config

    Added standard Scrutinizer config

    Hello!

    I'm helpful robot. I noticed you don't have a Scrutinizer config file. This one adds many code quality checks. If you are unsure of how to connect your repository to Scrutinizer, read the guide I wrote for you humans.

    Have a nice day! [brrrrb, click]

    opened by helpfulrobot 0
  • Added standard code of conduct file

    Added standard code of conduct file

    Hello!

    I'm helpful robot. Ever seen two robots fighting over code? That's because most of us know the robot code of conduct. Did you know SilverStripe has a code of conduct, for community interaction?

    Have a nice day! [tick tick tick]

    opened by helpfulrobot 0
  • Converted to PSR-2

    Converted to PSR-2

    Hello!

    I'm helpful robot. I noticed there were some deviations from PSR-2 in your code. The core committer team recently decided to transition SilverStripe Framework and CMS to PSR-2, and the supported module standard recommends following PSR-2. I've gone ahead and converted files in code and tests to PSR-2. If this sounds like something you'd like to merge then go right ahead! Feel free to ask questions or make suggestions for how I can help you more. I've been programmed with a wide range of responses.

    Have a nice day! [gzzzzrrrkt]

    opened by helpfulrobot 0
  • Compatibility with newer SS 4.x

    Compatibility with newer SS 4.x

    Version 2.0.0 has framework requirements at ^4, in master branch it's 4.1.x-dev with a commit saying it's not compatible with SS 4.2.

    Would it be possible to perhaps release a new major with the constraint relaxed back to ^4 or requiring ^4.3 or higher? Do we know what the issue was back in the day?

    opened by michalkleiner 0
  • Feature request: Allow more config options than just for the toolbar

    Feature request: Allow more config options than just for the toolbar

    I could extend the Config class to have my own toolbar config, or to disable the toolbar, however, other options such as for the status bar or the spell checker are one level above the toolbar in the simpleMDE configuration in javascript.

    In the file vendor/silverstripers/markdown/client/src/components/MarkdownEditorField/MarkdownEditorField.js on line 157 every other option such as spellChecker: false won't reach the simpleMDE options.

    It would be nice to be able to pass higher level configuration options as defined here: https://github.com/sparksuite/simplemde-markdown-editor#configuration

    opened by passchn 0
  • Image button not working

    Image button not working

    Version: 2.0.0 CMS Version 4.3.0 Tested browser: chrome/firefox

    Error Description: Clicking on the "insert image" or "embed media" button throws a javascript error

    vendor.js?m=1544502093:1 Uncaught Error: Could not find "store" in either the context or props of "Connect(t)". Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(t)".
        at o (vendor.js?m=1544502093:1)
        at new a (vendor.js?m=1544502093:1)
        at c._constructComponentWithoutOwner (vendor.js?m=1544502093:1)
        at c._constructComponent (vendor.js?m=1544502093:1)
        at c.mountComponent (vendor.js?m=1544502093:1)
        at Object.mountComponent (vendor.js?m=1544502093:1)
        at c.performInitialMount (vendor.js?m=1544502093:1)
        at c.mountComponent (vendor.js?m=1544502093:1)
        at Object.mountComponent (vendor.js?m=1544502093:1)
        at c.performInitialMount (vendor.js?m=1544502093:1)
    
    opened by nblum 2
Releases(2.0.0)
  • 2.0.0(Dec 22, 2017)

  • 2.0.0-beta4(Nov 3, 2017)

  • 2.0.0-beta3(Nov 2, 2017)

    New Features

    1. Short code parser for previews
    2. Configs moved on to the YMLs
    3. Customisable editor styles with modular css
    4. Namespace changed from silverstripe-markdown to markdown
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0-beta2(Oct 24, 2017)

    Includes

    MarkdownEditorConfig

    A class which is used to configure the tool bar of the markdown editor. Enables add / remove buttons and change behavior of the buttons

    **SilverStripe 4 - Beta 4 **

    Tested and supported for SilverStripe 4 beta 4

    ** Changed to a SilverStripe vendor module **

    Source code(tar.gz)
    Source code(zip)
  • 2.0.0-beta1(Oct 15, 2017)

    Updates

    1. SilverStripe 4 support
    2. Added and integrated with SilverStripe media (files and images)
    3. Added and integrated SilverStripe embeds (youtube, vimeo)
    4. React support for SimpleMDE
    Source code(tar.gz)
    Source code(zip)
Owner
SilverStripers
SilverStripers are a web development company. Specialised in SilverStripe based web development.
SilverStripers
Adds a "spam protection" field to SilverStripe userforms using Cloudflare's Turnstile service.

Turnstile for Silverstripe Adds a "spam protection" field to SilverStripe userforms using Cloudflare's Turnstile service. Maintainer Contact Ed Chipma

Webbuilders Group 3 Dec 15, 2022
Silverstripe-masquerade - SilverStripe module to allow users to "masquerade" as other users

SilverStripe Masquerade Module About This module is designed to allow an Administrator to "login" as another "Member" without changing their password

Daniel Hensby 14 Apr 14, 2022
Silverstripe-debugbar/ - SilverStripe DebugBar module

SilverStripe DebugBar module Requirements SilverStripe ^4.0 maximebf/php-debugbar jdorn/sql-formatter Installation You can install the debug bar with

Thomas Portelange 52 Dec 21, 2022
Silverstripe-fulltextsearch - Adds external full text search engine support to SilverStripe

FullTextSearch module Adds support for fulltext search engines like Sphinx and Solr to SilverStripe CMS. Compatible with PHP 7.2 Important notes when

Silverstripe CMS 42 Dec 30, 2022
Silverstripe-searchable - Adds to the default Silverstripe search by adding a custom results controller and allowing properly adding custom data objects and custom fields for searching

SilverStripe Searchable Module UPDATE - Full Text Search This module now uses Full Text Support for MySQL/MariaDB databases in version 3.* Adds more c

ilateral 13 Apr 14, 2022
A SilverStripe module for conveniently injecting JSON-LD metadata into the header of each rendered page in SilverStripe

A SilverStripe module for conveniently injecting JSON-LD metadata into the header of each rendered page in Silver

null 4 Apr 20, 2022
Bundle providing Honeypot field for the Form Builder in Ibexa DXP Experience/Commerce (3.X)

IbexaHoneypot Bundle providing Honeypot field for the Form Builder in Ibexa DXP Experience/Commerce (3.X) What is Honey pot? A honey pot trap involves

null 1 Oct 14, 2021
A measurement field for ProcessWire

Fieldtype Measurement This fieldtype allows a measurement unit to be stored with a corresponding measurement value ('magnitude'). The relevant details

Mark Evens 2 Aug 6, 2022
A layout field that forces translations to have the same structure.

Kirby translatedlayout plugin A layout field that forces translations to have anidentical structure to the one of the default language. This is an exp

Daan de Lange 12 Apr 25, 2022
A Symfony2 bundle that integrates Select2 as a drop-in replacement for a standard entity field on a Symfony form.

select2entity-bundle Introduction This is a Symfony bundle which enables the popular Select2 component to be used as a drop-in replacement for a stand

Ross Keatinge 214 Nov 21, 2022
Magento 2 extension. Strekoza_GoogleCategory. Add Category Attribute (field) - "Google Category"

Magento 2 extension. Strekoza_GoogleCategory Magento 2 extension. Add Category Attribute (field) - "Google Category" This exstension will add Category

Alex S 1 Feb 7, 2022
Nagios/Icinga plugin for checking SATEON field network device status

check_sateon Nagios/Icinga plugin for checking SATEON field network device status Max.Fischer [email protected] Tested on CentOS GNU/Linux 6.5 with Ici

null 1 May 27, 2022
Ranting field for the Filament forms

Ranting field for the Filament forms

null 14 Dec 11, 2022
Multi-language field export/import tool for ProcessWire

Language field export/import for ProcessWire Typically the way you translate page field values in ProcessWire is to edit a page, view the text in one

Ryan Cramer 3 Aug 19, 2022
SilverStripe Garbage Collection Module

SilverStripe Module for defining and processing Garbage Collection on SilverStripe Applications.

Brett Tasker 8 Aug 12, 2022
Silverstripe-sspy - Python based SSPAK export with higher reliability and cross-platform compatibility

SSPY - Python Stand-alone SSPAK solution © Simon Firesphere Erkelens; Moss Mossman Cantwell Usage: sspy [create|load|extract] (db|assets) --file=my.

Simon Erkelens 1 Jun 29, 2021
Sspak - Tool for managing bundles of db/assets from SilverStripe environments

SSPak SSPak is a SilverStripe tool for managing database and assets content, for back-up, restoration, or transfer between environments. The file form

Silverstripe CMS 45 Dec 14, 2022
Automatically delete old SiteTree page versions from Silverstripe

Version truncator for Silverstripe An extension for Silverstripe to automatically delete old versioned DataObject records from your database when a re

Ralph Slooten 35 Dec 7, 2022
Silverstripe-populate - Populate your database through YAML files

Populate Module This module provides a way to populate a database from YAML fixtures and custom classes. For instance, when a building a web applicati

Silverstripe CMS 22 Oct 3, 2022