Skip to content

Commit 57c0120

Browse files
committed
Fix: Update content format
1 parent 69b3c45 commit 57c0120

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

handling_rich_text.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ Since we want to have the ability to edit a post or comment in markdown, we will
1616

1717
> `Rich` is a Python library for writing rich text (with color and style) to the terminal, and for displaying advanced content such as tables, markdown, and syntax highlighted code.
1818
19-
With our form set up, there is no way that you can style your comment before it is posted. What we want to show users as they are typing their comments is something as this:
19+
With our form set up, there is no way that you can style your comment before it is posted. What we want to show users as they are typing their comments is something like this:
2020

2121
![Rich Text Preview](images/rich_text_preview.png)
2222

23-
There is a `flask-pagedown` extension we can use to enable client side markdown preview. Let us go ahead and install it:
23+
There is the `flask-pagedown` extension we can use to enable client side markdown preview. Let us go ahead and install it:
2424

2525
```python
2626
$ pip3 install flask-pagedown
2727
```
2828

2929
The `flask-pagedown` extension needs to be registered in our application instance:
3030

31-
`app/__init__.py: Register pagedown extension`
31+
`app/__init__.py`: Register pagedown extension
3232
```python
3333
from flask_pagedown import PageDown
3434

@@ -38,7 +38,7 @@ pagedown = PageDown(app)
3838

3939
The Editor is supported through two Javascript files. To include these files in your HTML document, you will need to call `pagedown.html_head()` from inside the `<head>` element of your page:
4040

41-
`app/templates/base.html: Include pagedown in template`
41+
`app/templates/base.html`: Include pagedown in template
4242
```html
4343
{% block head %}
4444
{{ super() }}
@@ -49,8 +49,9 @@ The Javascript files are loaded from a CDN, the files do not need to be hosted b
4949

5050
## Update Form with `PageDownField`
5151

52-
The extesion exports a `PagDownField` which is very similar to and works exactly as `TextAreaField`:
52+
The extention exports a `PagDownField` which is very similar to and works exactly as `TextAreaField`:
5353

54+
`app/forms.py`: Create form
5455
```python
5556
from flask_wtf import FlaskForm
5657
from flask_pagedown.fields import PageDownField #<---------------New
@@ -78,7 +79,7 @@ First, we need to install the `flask-sqlalchemy` extension:
7879
Then, we need to add the `db` variable to our application instance:
7980

8081

81-
`app/__init__.py: Add db variable`
82+
`app/__init__.py`: Add db variable
8283
```python
8384
# ...
8485
from flask_sqlalchemy import SQLAlchemy
@@ -90,7 +91,7 @@ db = SQLAlchemy(app)
9091
The application expects certain configuration variables to be set in the `config.py` file. Add the following to the `config` module:
9192

9293

93-
`config.py: Add db configuration`
94+
`config.py`: Add db configuration
9495
```python
9596
# ...
9697

@@ -152,6 +153,9 @@ The HTML code for the rendered blog post is cached in a new field added to the C
152153

153154
## Update the Comment Table
154155

156+
First, we need to add a `html` field to the table. We can do this by adding the following to the `Comment` model:
157+
158+
`app/models.py`: Add html field
155159
```python
156160
class Comment(db.Model):
157161
id = db.Column(db.Integer, primary_key=True)

0 commit comments

Comments
 (0)