Giter Site home page Giter Site logo

markdownify's Introduction

Markdownify

Developed and maintained by David Eads ([email protected]) for Fermi National Accelerator Laboratory and the U.S. Department of Energy as part of the E-Center Project.

This module provides the Markdownify library (included) to Drupal via API functions and URLs that convert HTTP POSTed input for users with the correct permissions and output JSON, appropriate for AJAX callbacks.

Markdownify is a PHP library that converts HTML to Markdown and Markdown Extra. Markdownify is licensed under the GNU Lesser General Public License (LGPL) & is distributed with this package for convenience.

Markdownify module is licensed under the Fermitools license (see LICENSE.txt).

Reference

Permissions

Users must have the access markdownify permission to convert text, and may only access conversion when markdownify_on() is invoked (see below).

Users with the markdownify any text permission may POST arbitrary input to the Markdown converters. Grant with care! This permission could easily allow remote users to use your site to return arbitrary, potentially unsafe data payloads.

WYSIWYG Integration

If WYISWYG module is installed, this module provides a TinyMCE plugin that uses Markdownify's AJAX callbacks to use TinyMCE as a Markdown editor. To use, enable on a WYISWYG module profile using a text format with Markdown as the first filter.

API functions

markdownify_include()

Include the Markdownify libraries. Call if you need access to the Markdownify and Markdownify_Extra APIs.

markdownify_on()

Turn on Markdownify. Sets a token that is used for access checking in the callback functions. Call when using Markdownify on a content editing form.

AJAX callback URLs

/markdown2html

The 'input' element of the POST will be converted from Markdown to HTML and returned as the 'output' element of a JSON object.

/html2markdown

The 'input' element of the POST will be converted from HTML to Markdown and returned as the 'output' element of a JSON object.

/admin/markdownify/test

Tests, including this README file.

Hooks

This module defines these _alter hooks which take an input string as their parameter:

  • markdownify_markdown2html_preprocess_alter
  • markdownify_markdown2html_postprocess_alter
  • markdownify_html2markdown_preprocess_alter
  • markdownify_html2markdown_postprocess_alter

Use the alter hooks to manipulate data as it is processed by Markdownify. For example, use mymodule_markdownify_html2markdown_postprocess_alter to remove extraneous tags added by TinyMCE when converting TinyMCE source to Markdown.

markdownify's People

Contributors

eads avatar

Stargazers

Phillip Ressler avatar  avatar

Watchers

 avatar James Cloos avatar

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.