{"id":13650643,"url":"https://github.com/HelloBetterLTD/markdownfield","last_synced_at":"2025-04-22T18:32:07.775Z","repository":{"id":29901352,"uuid":"33447025","full_name":"HelloBetterLTD/markdownfield","owner":"HelloBetterLTD","description":"Markdown field for SilverStripe","archived":false,"fork":false,"pushed_at":"2022-10-12T08:45:11.000Z","size":2259,"stargazers_count":11,"open_issues_count":5,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T20:50:53.752Z","etag":null,"topics":["javascript","markdown","markdown-editor","php","silverstripe-4","silverstripe-module"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HelloBetterLTD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-05T16:25:39.000Z","updated_at":"2023-07-24T22:01:42.000Z","dependencies_parsed_at":"2022-08-24T05:00:24.865Z","dependency_job_id":null,"html_url":"https://github.com/HelloBetterLTD/markdownfield","commit_stats":null,"previous_names":["hellobetterltd/markdownfield"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloBetterLTD%2Fmarkdownfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloBetterLTD%2Fmarkdownfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloBetterLTD%2Fmarkdownfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloBetterLTD%2Fmarkdownfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HelloBetterLTD","download_url":"https://codeload.github.com/HelloBetterLTD/markdownfield/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249676782,"owners_count":21309448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","markdown","markdown-editor","php","silverstripe-4","silverstripe-module"],"created_at":"2024-08-02T02:00:38.788Z","updated_at":"2025-04-22T18:32:07.317Z","avatar_url":"https://github.com/HelloBetterLTD.png","language":"JavaScript","funding_links":[],"categories":["Very Useful Modules"],"sub_categories":["Fancy Form Fields"],"readme":"# MarkdownField\n\n[![CircleCI](https://circleci.com/gh/SilverStripers/markdownfield/tree/master.svg?style=svg)](https://circleci.com/gh/SilverStripers/markdownfield/tree/master)\n[![codecov](https://codecov.io/gh/SilverStripers/markdownfield/branch/master/graph/badge.svg)](https://codecov.io/gh/SilverStripers/markdownfield)\n\n\nThis module introduces a new DB field type Markdown \u0026 Markdown Editor. It uses github style Markdown style. And uses the simple markdown\neditor.\n\nhttps://github.com/sparksuite/simplemde-markdown-editor\n\nhttps://github.com/cebe/markdown\n\nThe module is still under development, but soon will be ready, with link popups and image selectors.\n\n## Installation\n\nUse composer\n\n```\ncomposer require silverstripers/markdown dev-master\n```\n\n## Basic Usage\n\nTo use the markdown DB field in your data objects the basic code would look like\n\n```\n\nclass MyDataClass extends DataObject\n{\n\n    private static $db = [\n\t\t'MarkdownContent'\t\t=\u003e 'MarkdownText'\n\t];\n\n}\n\n```\n\nMarkdownText knows to add a markdown editor for your fields, but if you need to manually specify the type of field use\n\n```\npublic function getCMSFields()\n{\n    $fields = parent::getCMSFields();\n\n    $fields-\u003eaddFieldsToTab('Root.Sidebar', [\n        \\SilverStripers\\markdown\\forms\\MarkdownEditorField::create('MarkdownContent', 'Content'),\n    ]);\n\n    return $fields;\n}\n```\n\n## Force all the fields to use Markdown\n\nIf you are looking to replace all the fields of HTMLText to markdown use the following configs in the config.yml.\n\nThis should override any instances of the HTMLText replacements with MarkdownText\n\n```\n---\nName: myconfigs\nAfter:\n  - '#corefieldtypes'\n---\nSilverStripe\\Core\\Injector\\Injector:\n  HTMLText:\n    class: SilverStripers\\markdown\\db\\MarkdownText\n```\n\n## Add preview styles\n\nYou 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.\n\nTo achived this create a css file in `mysite/css/` and name it as `editor.css`.\n\nYour CSS rules have to be nested in a class so it wont affect other areas of the CMS.\n\n```\n.markdown-preview {\n    background-color: white;\n    padding: 20px;\n    font-size: 20px;\n}\n\n.markdown-preview h1 {\n    font-size: 30px;\n}\n````\n\nIf 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\nthe EditorConfig's identifier on to the preview pane. The below is an example for the default configs.\n\n```\n.markdown-preview.default {\n    background-color: white;\n    padding: 20px;\n    font-size: 14px;\n    line-height: 20px;\n}\n\n.markdown-preview.default h1 {\n    font-size: 24px;\n    line-height: 30px;\n}\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHelloBetterLTD%2Fmarkdownfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHelloBetterLTD%2Fmarkdownfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHelloBetterLTD%2Fmarkdownfield/lists"}