1
0

vault backup: 2025-12-06 00:29:07
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 1m17s

This commit is contained in:
2025-12-06 00:29:07 +01:00
parent fb75fc04a6
commit 038cb1c2dd
5 changed files with 67 additions and 47 deletions

View File

@@ -295,23 +295,4 @@ Jongradienter Na/Kalium mkt inne/ut på av ATPaset-pump
ABC kräver 2 ATP fosfo+defosfo
MDR inblandat i pumpar
![[Pasted image 20251125132516.png]]

View File

@@ -1,25 +0,0 @@
from obsidian_parser import Vault
import markdown
v = Vault("content")
note = v.get_note("Biokemi/Cellulära processer/Transport över cellmembran/Anteckningar.md")
body = markdown.markdown(note.reading_view)
html = f"""<!html>
<head>
<meta charset="utf-8">
<style>
p {{
white-space: pre-wrap;
}}
</style>
</head>
<body>
{body}
</body>
</html>
"""
with open("test.html", "w") as f:
f.write(html)
import webbrowser
webbrowser.open("test.html")

46
wip/static.py Normal file
View File

@@ -0,0 +1,46 @@
import pathlib
from obsidian_parser import Vault
import markdown
import jinja2
root_dir = pathlib.Path(__file__).parent
vault = Vault(root_dir / ".." / "content")
note = vault.get_note("Biokemi/Cellulära processer/Transport över cellmembran/Anteckningar.md")
loader = jinja2.FileSystemLoader(root_dir / "templates")
env = jinja2.Environment(loader=loader)
from markdown.preprocessors import Preprocessor
import re
class NoRender(Preprocessor):
""" Skip any line with words 'NO RENDER' in it. """
def run(self, lines):
new_lines = []
for line in lines:
print(repr(line))
m = re.search(r"!\[\[(.*)\]\]", line)
if m:
print(m.groups())
return new_lines
from markdown.extensions import Extension
class MyExtension(Extension):
def extendMarkdown(self, md):
md.preprocessors.register(NoRender(md), 'mypattern', 175)
m = markdown.Markdown(extensions=[])
print(m.registeredExtensions)
env.filters["markdown"] = m.convert
output = root_dir / "test.html"
template = env.get_template("base.html")
with output.open("w", encoding="utf-8") as f:
print(note.reading_view)
output = template.render(note=note, vault=vault)
f.write(output)
#import webbrowser
#webbrowser.open(output.as_uri())
#print(f"Written to {output}")

15
wip/templates/base.html Normal file
View File

@@ -0,0 +1,15 @@
<html lang="en">
<head>
<meta charset="utf-8">
<style>
p {
white-space: pre-wrap;
}
</style>
<title>{{note.title}}</title>
</head>
<body>
<h1>{{note.title}}</h1>
{{note.reading_view | markdown}}
</body>
</html>

View File

@@ -1,4 +1,4 @@
<!html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
@@ -6,8 +6,10 @@
white-space: pre-wrap;
}
</style>
<title>Anteckningar</title>
</head>
<body>
<h1>Anteckningar</h1>
<p>Diffusion är något INTE behöver hjälp
Passiv vs Aktiv transport
Faciliterad diffusion</p>
@@ -272,5 +274,6 @@ kanalfogar binder ihop små celler, t.ex. näring i benceller
Jongradienter Na/Kalium mkt inne/ut på av ATPaset-pump
ABC kräver 2 ATP fosfo+defosfo
MDR inblandat i pumpar</p>
<p>!Pasted image 20251125132516.png</p>
</body>
</html>
</html>