Add new templates and tests for improved functionality
- Created index.html template for the homepage with service cards and partner logos. - Added page_from_md.html template for rendering pages from markdown. - Developed services.html template detailing various services offered. - Implemented tests for link handling in markdown, ensuring external links open in new tabs and internal links function correctly. - Enhanced markdown parser tests to validate heading extraction, content rendering, and link safety. - Introduced utility tests for template rendering, HTML minification, and JavaScript minification. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
from lib.markdown_parser import markdown_to_html_lines
|
||||
|
||||
|
||||
def test_javascript_link_neutralized():
|
||||
md = '[bad](javascript:alert(1))'
|
||||
html = markdown_to_html_lines(md)
|
||||
assert 'href="#unsafe"' in html
|
||||
assert 'javascript:' not in html
|
||||
|
||||
|
||||
def test_data_link_neutralized():
|
||||
md = '[bad](data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)'
|
||||
html = markdown_to_html_lines(md)
|
||||
assert 'href="#unsafe"' in html
|
||||
assert 'data:' not in html
|
||||
Reference in New Issue
Block a user