Coverage for src/markdown_katex/html.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

5 statements  

1# This file is part of the markdown-katex project 

2# https://github.com/mbarkhau/markdown-katex 

3# 

4# Copyright (c) 2019-2021 Manuel Barkhau (mbarkhau@gmail.com) - MIT License 

5# SPDX-License-Identifier: MIT 

6_STYLESHEET_LINK = """ 

7<link rel="stylesheet" 

8 href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" 

9 integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" 

10 crossorigin="anonymous" /> 

11""" 

12 

13_KATEX_IMAGE_STYLES = """ 

14<style type="text/css"> 

15 .katex img { 

16 object-fit: fill; 

17 padding: unset; 

18 display: block; 

19 position: absolute; 

20 width: 100%; 

21 height: inherit; 

22 } 

23</style> 

24""" 

25 

26KATEX_STYLES = _STYLESHEET_LINK + _KATEX_IMAGE_STYLES 

27 

28 

29HTML_TEMPLATE = """ 

30<!DOCTYPE html> 

31<html> 

32<head> 

33 <title>Test Katex</title> 

34 {{stylesheet_link}} 

35 <style type="text/css"> 

36 body{background: white; } 

37 </style> 

38</head> 

39<body> 

40Generated with markdown-katex 

41<hr/> 

42{{content}} 

43</body> 

44</html> 

45""" 

46 

47HTML_TEMPLATE = HTML_TEMPLATE.replace("{{stylesheet_link}}", _STYLESHEET_LINK)