Making user-made HTML templates safe

后端 未结 4 1903
野的像风
野的像风 2021-01-06 16:32

I want to allow users to create tiny templates that I then render in Django with a predefined context. I am assuming the Django rendering is safe (I asked a question about t

4条回答
  •  梦谈多话
    2021-01-06 16:44

    "Use a markup language that produces safe HTML."

    Clearly, the only sensible approach.

    "The problem with this is that most markup languages are not very powerful layout-wise."

    False.

    "no way to center elements in ReST."

    False.

    Centering is a style -- a CSS feature -- not a markup feature.

    1. The want to center is to assign an CSS Class to a piece of text. The .. class:: directive does this.

    2. You can also define your own interpreted text role, if that's necessary for specifying an inline class on a piece of markup.

提交回复
热议问题