2013-11-05T07:03:42Z
(I can't help it. I keep coming up with ideas for cool Flask extensions.)
Flask Web Development Miguel Grinberg download Z-Library. Download books for free. Flask Web Development: Developing Web Applications With Python Miguel Grinberg download Z-Library. Download books for free. Triangle gas washing bottle,Capacity 100ml,Conical Ground mouth flat flush flask,Gas wash bottle with tick mark,Shisha hookah. “Micro” does not mean that your whole web application has to fit into a single Python file (although it certainly can), nor does it mean that Flask is. (I can't help it. I keep coming up with ideas for cool Flask extensions.)If you've asked or answered a question on Stack Overflow you have seen the editor that they use. You type your text using.
If you've asked or answered a question on Stack Overflow you have seen the editor that they use. You type your text using Markdown syntax in a standard text area HTML control and below it a preview is generated as you type. This editor is powered by an open source project called PageDown.
Today I'm introducing Flask-PageDown, a wrapper extension that makes it really easy to add this control to your Flask-WTF based forms.
Demo
Below is a an example that will give you an idea of what this extension can do in your own application. Type Markdown in the text editor below and see how it gets converted on the fly to HTML!
Flask Markdown Render
Installation & Configuration
You can install the extension with pip:
The extension needs to be initialized after the application instance is created:
You can also use the init_app(app)
format.
The Editor is supported via two Javascript files. To include these files in your HTML document you have to call pagedown.html_head()
from inside the <head>
element of your page:
The Javascript files are loaded from a CDN, the files do not need to be hosted by your application. If you prefer to host these files locally then replace the html_head()
call with your own <script>
tags for files Markdown.Converter.js and Markdown.Sanitizer.js (or their minified versions).
Creating a Form with a PageDown Field
The extension exports a PageDownField
class that works exactly like a TextAreaField
. Here is an example form that uses this field:
The field can be rendered to a template in the usual way. For example:
The preview element does not need to be added, the extension does that for you.
Note that when a form with a PageDownField
is submitted the raw Markdown text is submitted. The form does not receive the HTML preview. If you need to store the HTML in the server then you should use a server-side Markdown converter like Flask-Markdown.
Styles
You can define custom styles for the text area and preview elements. The text area can be referenced with the flask-pagedown-input
CSS class. The CSS class for the preview is flask-pagedown-preview
.
Feedback and Contributions Accepted
As always I look forward to your comments and suggestions. Please write below in the comments.
At this time the extension does not display a toolbar like the one on Stack Overflow. I will probably add that in a future release, but if you get to it first please send me a pull request on github.
Miguel
Hello, and thank you for visiting my blog! If you enjoyed this article, please consider supporting my work on this blog on Patreon!
36 comments
#1cancerballs said 2013-11-05T23:24:49Z
#2Miguel Grinberg said 2013-11-05T23:52:25Z
#3mg said 2013-12-01T02:38:12Z
#4mlsn said 2013-12-15T09:54:21Z
#5Miguel Grinberg said 2013-12-15T18:56:53Z
#6mlsn said 2013-12-15T20:33:09Z
#7Deepsys9 said 2014-02-12T19:49:53Z
#8Miguel Grinberg said 2014-02-12T20:12:27Z
#9Luca Barbato said 2014-04-19T14:26:23Z
#10David H Hagan said 2014-04-21T23:10:21Z
#11progerz said 2014-04-23T09:44:20Z
#12Miguel Grinberg said 2014-04-23T14:37:48Z
#13Horia said 2014-08-27T09:36:39Z
#14Miguel Grinberg said 2014-08-30T05:44:45Z
#15yassine said 2015-04-15T21:13:50Z
#16luna said 2015-11-18T16:03:28Z
#17Miguel Grinberg said 2015-11-19T05:17:37Z
#18luna said 2015-11-26T01:31:22Z
#19Miguel Grinberg said 2015-11-28T18:39:21Z
#20mannaia said 2015-12-14T20:43:53Z
#21Miguel Grinberg said 2015-12-22T20:05:03Z
#22Michael said 2017-07-03T22:30:19Z
#23Miguel Grinberg said 2017-07-04T00:06:06Z
#24Michael said 2017-07-04T00:51:07Z
#25ella sherilyn ramos said 2017-07-04T08:09:43Z
Leave a Comment
Flask Markdown Blog
1markdown
Англо-русский словарь промышленной и научной лексики >markdown
2величина скидки
Русско-английский словарь по экономии >величина скидки
3снижение оценочной стоимости
Banks. Exchanges. Accounting. (Russian-English) >снижение оценочной стоимости
4величина скидки
Бизнес, юриспруденция. Русско-английский словарь >величина скидки
См. также в других словарях:
Markdown — is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people to write using an easy to read, easy to write plain text format, then convert it to structurally valid XHTML (or HTML) .[1] The language takes… … Wikipedia
Markdown — (маркдаун) облегчённый язык разметки. Первоначально создан Джоном Грубером (англ. John Gruber) и Аароном Шварцем, целью которых являлось создание максимально удобочитаемого и удобного в публикации облегчённого языка разметки. Многие… … Википедия
Markdown — es un lenguaje de marcado ligero creado originalmente por John Gruber [1] y Aaron Swartz [2] que trata de conseguir la máxima legibilidad y publicabilidad tanto en sus forma de entrada como de salida, inspirándose muchas convenciones existentes… … Wikipedia Español
Markdown — ist eine vereinfachte Auszeichnungssprache, die von John Gruber und Aaron Swartz entworfen wurde. Ein Ziel von Markdown ist, dass schon die Ausgangsform ohne weitere Konvertierung leicht lesbar ist. Als Auszeichnungselemente wurden daher vor… … Deutsch Wikipedia
Markdown — est un langage de balisage léger créé par John Gruber et Aaron Swartz. Le but de la syntaxe Markdown est d offrir une syntaxe facile à lire et à écrire. C est à dire qu un document formaté selon Markdown devrait pouvoir être publié comme tel, en… … Wikipédia en Français
Markdown — Markdown refers to the amount of money that a buyer is given in order to mark down items to clear them out of their stock. Sometimes the buyer will ask the manufacturer for markdown money to clear out stock of that particular vendor s… … Historical Dictionary of the Fashion Industry
markdown — index discount, rebate Burton s Legal Thesaurus. William C. Burton. 2006 … Law dictionary
markdown — ☆ markdown [märk′doun΄ ] n. 1. a marking for sale at a reduced price 2. the amount of reduction in price … English World dictionary
markdown — The amount subtracted from the selling price of securities when they are sold to a dealer in the OTC market. Also, the discounted price of municipal bonds after the market has shown little interest in the issue at the original price. Bloomberg… … Financial and business terms
markdown — mark|down [ˈma:kdaun US ˈma:rk ] n a reduction in the price of something markdown of ▪ a markdown of 15% … Dictionary of contemporary English
markdown — UK [ˈmɑː(r)kˌdaʊn] / US [ˈmɑrkˌdaʊn] noun [countable] Word forms markdown : singular markdown plural markdowns a reduction in the price of something … English dictionary
Книги
- Язык R в задачах науки о данных. Импорт, подготовка, обработка, визуализация и моделирование данных, Уикем Хэдли, Гроулмунд Гарретт. Овладейте искусством превращения необработанных первичных данных в плодотворные догадки, гипотезы и новые знания с помощью языка R. Эта книга задумана как введение в вычислительную среду R,… ПодробнееКупить за 2592 руб