MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _is_graphify_note

Function _is_graphify_note

graphify/export.py:892–927  ·  view source on GitHub ↗

Whether a vault note carries graphify's own frontmatter signature. Every note graphify writes opens with a YAML frontmatter block tagging it in the ``graphify/`` namespace:: --- source_file: "d0.md" tags: - graphify/document - graphify/EXTRACTED

(path: Path)

Source from the content-addressed store, hash-verified

890
891
892def _is_graphify_note(path: Path) -> bool:
893 """Whether a vault note carries graphify's own frontmatter signature.
894
895 Every note graphify writes opens with a YAML frontmatter block tagging it in
896 the ``graphify/`` namespace::
897
898 ---
899 source_file: "d0.md"
900 tags:
901 - graphify/document
902 - graphify/EXTRACTED
903 ---
904
905 Only that block is inspected, and only a tag entry inside it counts — a
906 user's note that merely mentions graphify in its prose is not adopted.
907
908 Community overview notes are recognised separately: they carry no
909 frontmatter at all, so they are identified by graphify's own filename prefix
910 together with the Dataview query it writes into the body. Requiring both
911 keeps a user's own ``_COMMUNITY_*.md`` from being adopted on the name alone.
912 """
913 try:
914 with path.open("r", encoding="utf-8", errors="replace") as fh:
915 head = fh.read(_NOTE_FRONTMATTER_PROBE_BYTES)
916 except OSError:
917 return False
918 if path.name.startswith(_COMMUNITY_PREFIX) and _COMMUNITY_QUERY_MARKER in head:
919 return True
920 if not head.startswith("---"):
921 return False
922 for line in head.splitlines()[1:]:
923 if line.strip() == "---":
924 return False # frontmatter closed without a graphify tag
925 if _GRAPHIFY_TAG_RE.match(line):
926 return True
927 return False
928
929
930def _adopt_pre_manifest_notes(out: Path) -> set[str]:

Calls 1

readMethod · 0.45