syntax_html.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {% extends "article.html" %}
  2. {% block title %}
  3. <h1>Write content directly from HTML files</h1>
  4. {% endblock %}
  5. {% block content %}
  6. <h2>Use HTML syntax directly</h2>
  7. <p>
  8. Write content directly in HTML syntax.
  9. </p>
  10. <p>This file is written directly in html, click on the source code at the top right <code>edit this page</code>view</p>
  11. <h2>Also supports <a href="https://jinja.palletsprojects.com/" target="_blank">Jinja2</a> syntax</h2>
  12. <pre class="line-numbers language-markdown">
  13. <code class="language-markdown">
  14. {% raw %}
  15. {% extends "article.html" %}
  16. Note that "article.html" needs to be enclosed in quotation marks, otherwise it will prompt that the article cannot be found
  17. {% block title %}
  18. <h1>Write content directly from HTML files</h1>
  19. {% endblock %}
  20. {% block content %}
  21. <h2>Use HTML syntax directly</h2>
  22. {% endblock %}
  23. {%endraw%}
  24. </code></pre>
  25. Here you can see that this page inherits from <code>article.html</code> and modifies <code>title</code> and <code>content</code> so that the navigation bar and side can be preserved bar, and use themes too.
  26. For the specific content that can be modified, you can view the source code of the template, the templates that can be used, and refer to the template files provided by the theme, such as the template files of the default theme at <a href="https://github.com/teedoc/teedoc/tree/main" /plugins/teedoc-plugin-theme-default/teedoc_plugin_theme_default/templates" target="_blank">here</a>
  27. And the variables that the page can use refer to the variable description in <a href="../usage/layout_template.html">Custom Page Template</a>.
  28. <h2>html files are used as template files</h2>
  29. In addition to writing pages directly in html, you can also write a template in html first, put it in the <code>layout</code> directory, and use this template in the <code>.md</code> file.
  30. The content in the <code>.md</code> file will be passed to <code>html</code> in the <code>body</code> variable, directly through <code>{% raw %}{{ body| safe }}{% endraw %}</code> use,
  31. Here <code>safe</code> means no escaping, so that html can be written directly in the <code>.md</code> file.
  32. See <a href="../usage/layout_template.html">Custom Page Templates</a> for more custom template content.
  33. {% endblock %}