Slide 93
Slide 93 text
Server-Side Markdown
v0.19 ··•······
A SQLAlchemy change event triggers the Markdown rendering.
The Markdown text is rendered in three steps:
·
·
The text is rendered to HTML.
Bleach is used to filter any HTML tags not in the white list.
Bleach's l
i
n
k
i
f
y
(
) function is used to convert any plain URLs to links.
-
-
-
f
r
o
m m
a
r
k
d
o
w
n i
m
p
o
r
t m
a
r
k
d
o
w
n
i
m
p
o
r
t b
l
e
a
c
h
c
l
a
s
s C
o
m
m
e
n
t
(
d
b
.
M
o
d
e
l
)
:
# .
.
.
@
s
t
a
t
i
c
m
e
t
h
o
d
d
e
f o
n
_
c
h
a
n
g
e
d
_
b
o
d
y
(
t
a
r
g
e
t
, v
a
l
u
e
, o
l
d
v
a
l
u
e
, i
n
i
t
i
a
t
o
r
)
:
a
l
l
o
w
e
d
_
t
a
g
s = [
'
a
'
, '
a
b
b
r
'
, '
a
c
r
o
n
y
m
'
, '
b
'
, '
b
l
o
c
k
q
u
o
t
e
'
, '
c
o
d
e
'
,
'
e
m
'
, '
i
'
, '
l
i
'
, '
o
l
'
, '
p
r
e
'
, '
s
t
r
o
n
g
'
, '
u
l
'
,
'
h
1
'
, '
h
2
'
, '
h
3
'
, '
p
'
]
t
a
r
g
e
t
.
b
o
d
y
_
h
t
m
l = b
l
e
a
c
h
.
l
i
n
k
i
f
y
(
b
l
e
a
c
h
.
c
l
e
a
n
(
m
a
r
k
d
o
w
n
(
v
a
l
u
e
, o
u
t
p
u
t
_
f
o
r
m
a
t
=
'
h
t
m
l
'
)
,
t
a
g
s
=
a
l
l
o
w
e
d
_
t
a
g
s
, s
t
r
i
p
=
T
r
u
e
)
)
d
b
.
e
v
e
n
t
.
l
i
s
t
e
n
(
C
o
m
m
e
n
t
.
b
o
d
y
, '
s
e
t
'
, C
o
m
m
e
n
t
.
o
n
_
c
h
a
n
g
e
d
_
b
o
d
y
)
a
p
p
/
m
o
d
e
l
s
.
p
y
93/123