Todo
A list of things to do.
Document embedding generation process
Generate summary fragments for empty top-level headings
- [] Issue noticed at notes / Trigger a GET request to an API route by clicking a link.
I’m intentionally not generating HTML fragments for empty sections:
for child in root.iterchildren():
if child.tag in heading_tags:
if current_fragment is not None and has_text(current_fragment):
current_fragment = fix_relative_links(current_fragment, rel_path)
html_fragment = serialize(current_fragment, pretty_print=False)
html_heading = serialize(current_heading_element, pretty_print=False)
embeddings_text = section_texts(current_fragment, headings_path)
sections.append(
{
"html_fragment": html_fragment,
"html_heading": html_heading,
"heading_id": heading_id,
"heading_href": heading_href,
"headings_path": headings_path,
"embeddings_text": embeddings_text,
}
)
The has_text function returns a boolean:
def has_text(element: HtmlElement) -> bool:
text = "".join(element.itertext()).strip()
if text:
return True
else:
return False
This approach made more sense when the fragments were only being used as search results. Now that they’re also being displayed for internal link clicks, it would be good to handle the case. Maybe the fragment could be a heading summarization, with ellipsis used to indicate the section text?
## H2 heading that isn't followed by a paragraph
### H3 heading
...
### Another H3 heading
...
Wrong HTML fragment being served for imaginary numbers link
- The fragment served from the link in this section is wrong
[/notes/introduction-to-complex-numbers/#imaginary-numbers](notes/introduction-to-complex-numbers/#imaginary-numbers)
That note has been moved to superseded / Imaginary numbers. That instance of the issue is resolved, but there seems to be a case where links are being associated with the wrong db ID.
There are a few things that could be going on with that. Here’s the link [notes / Imaginary numbers](/notes/imaginary-numbers/)
It seems that the wrong fragment is in the database.
The issue is happening again here: notes / Introduction to imaginary numbers#an-imaginary-number-is-also-a-complex-number