Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 9f9c5bb

Browse files
committed
Tidy
1 parent 4b602cf commit 9f9c5bb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@ This module adds a field and a data type that allows for Markdown editing in the
33

44
It is integrated with the [SimpleMDE Markdown Editor](https://github.com/NextStepWebs/simplemde-markdown-editor) for CMS editing (see "Editor limitations" below).
55

6+
67
## Requirements
78
- SilverStripe 3.x
89

10+
911
## Usage
1012
Use the Markdown data type as your fields data type, then use the SimpleMDEEditor field in the CMS for editing.
1113

14+
1215
### Page class:
1316

1417
```php
1518
class MyMarkdownPage extends Page
1619
{
17-
public static $db=array(
20+
public static $db = array(
1821
'MarkdownContent'=>'Markdown'
1922
);
2023

2124
public function getCMSFields()
2225
{
23-
$fields=parent::getCMSFields();
26+
$fields = parent::getCMSFields();
2427

2528
$editor = SimpleMDEEditor::create('MarkdownContent', 'Page Content (Markdown)');
2629
$fields->addFieldToTab('Root.Main', $editor);
@@ -39,6 +42,7 @@ class MyMarkdownPage extends Page
3942
```
4043

4144
### .htaccess:
45+
4246
The JavaScript and CSS resources needed to show the editor is unfortunately installed in the `vendor` folder. By default, SilverStripe blocks all HTTP requests to it (note that we do not want to include the dependencies directly because we want Composer to handle those dependencies). In order to get this to work, we'll need to allow access to those resources.
4347

4448
Add the following line:
@@ -57,12 +61,13 @@ so that the `.htaccess` file would look similar to the following:
5761

5862
```
5963
# Deny access to potentially sensitive files and folders
60-
RewriteCond %{REQUEST_FILENAME} !\.(js|css)$
64+
RewriteCond %{REQUEST_FILENAME} !\.(js|css)$
6165
RewriteRule ^vendor(/|$) - [F,L,NC]
6266
6367
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
6468
RewriteRule composer\.(json|lock) - [F,L,NC]
6569
```
6670

6771
## Editor limitations:
72+
6873
SimpleMDE has some nice features such as full-page editing/preview, as well as "Side by Side" editing [see demo](http://nextstepwebs.github.io/simplemde-markdown-editor/). Unfortunately this doesn't play nice with SilverStripe's CMS as the fullscreen elements are positioned statically. Rather than some ugly hacking, and until someone hopefully finds an elegant solution (pull requests please), fullscreen & side-by-side functionality has been hidden from the toolbar.

0 commit comments

Comments
 (0)