A Markdown decomposition core for context graphs: parses Markdown content (frontmatter, structure, and [[wiki-links]]) into provenance-carrying graph nodes and edges. First source = the ecosystem's own memory/decision files; generalizes to any Markdown corpus.
Project description
cjm-markdown-decompose-core
A Markdown decomposition core for context graphs: parses Markdown content (frontmatter, structure, and [[wiki-links]]) into provenance-carrying graph nodes and edges. First source = the ecosystem's own memory/decision files; generalizes to any Markdown corpus.
Modules
cjm_markdown_decompose_core.__init__cjm_markdown_decompose_core.extract— Map parsed Markdown onto dev-graph-schema nodes (coarse tier).cjm_markdown_decompose_core.ingest— Flatten decomposed notes into graph elements for idempotent extension.cjm_markdown_decompose_core.parse— Schema-free Markdown parsing (stdlib + PyYAML).cjm_markdown_decompose_core.project— Projections from the decomposed content back out to files.cjm_markdown_decompose_core.relations— Per-source-type relationship harvesting from parsed Markdown.cjm_markdown_decompose_core.sections— Decompose a Markdown body into ordered Section nodes (the navigable unit).tests.test_extract_project— Extract markdown -> NoteNode and project notes -> MEMORY.md index (with idempotency).tests.test_ingest_graphproject— Corpus -> graph elements, and projecting the index back from graph nodes.tests.test_parse— Schema-free Markdown parsing.tests.test_relations— Per-source-type relationship harvesters + profile dispatch + extract wiring.tests.test_sections— Body -> ordered Section nodes: anchors, hierarchy, verbatim text, disambiguation.tests_manual.memory_body_roundtrip— M1 round-trip: memory BODIES -> graph (extend_graph) -> byte-exact file text.tests_manual.memory_roundtrip— Inc 1 round-trip: memory corpus -> graph (extend_graph) -> MEMORY.md projection.tests_manual.notes_slice— Runtime harness: decompose a real christianjmills/posts slice through the full
API
cjm_markdown_decompose_core.extract
note_from_filefunction — Read a Markdown file and map it to a coarseNoteNode.note_from_parsedfunction — Build a coarseNoteNodefrom already-parsed Markdown.note_from_textfunction — Parse + map in one step from in-memory text (hashes the UTF-8 bytes).note_type_fromfunction — Read the memory category frommetadata.type(None when absent).slug_fromfunction — Derive the stable slug: frontmatternameif present, else the path.title_fromfunction — Derive a display title: explicit frontmattertitle, else the slug titleized.
cjm_markdown_decompose_core.ingest
corpus_graph_elementsfunction — Collect notes into the node + edge wire-dict listsextend_graphexpects.
cjm_markdown_decompose_core.parse
ParsedMarkdownclass — The structural decomposition of one Markdown document.extract_headingsfunction — Extract ATX headings (#..######) as (level, text) pairs.extract_wiki_linksfunction — Extract[[wiki-link]]targets from the body, de-duplicated, order-preserved.parse_frontmatterfunction — Parse frontmatter YAML into a dict (empty dict when absent).parse_markdownfunction — Parse a Markdown document into frontmatter + body + wiki-links + headings.split_frontmatterfunction — Split a leading----delimited YAML frontmatter block from the body.strip_codefunction — Blank out fenced + inline code spans (replaced with a space, length-agnostic).
cjm_markdown_decompose_core.project
first_sentencefunction — A deterministic terse hook: the description's first sentence, capped.note_index_linefunction — Render one index line from a note's frontmatter-derived fields.note_text_from_graph_nodesfunction — Reconstruct a note's file text FROM the graph (frontmatter_raw + ordered raw spans).note_view_from_graph_nodefunction — Reconstruct an index-relevantNoteNodefrom a queried graph node.render_memory_indexfunction — Render aMEMORY.mdindex: notes grouped by category, one line each.render_memory_index_from_graph_nodesfunction — Render the memory index FROM queried graph nodes (the self-hosting path).render_note_textfunction — Reassemble a note's exact file text from its verbatim parts (lossless mode).render_onboarding_surfacefunction — Render the onboarding surface: orientation + how-to-query + resident PUSH core + landmark map + how-to-pull.
cjm_markdown_decompose_core.relations
NoteRelationsclass — The harvested relationship signals for one note (beyond[[wiki-links]]).detect_profilefunction — Detect the source-type profile from the frontmatter shape.harvest_aliasesfunction — Harvestaliases(old URLs) -> bare permalinks (alternate identities).harvest_categoriesfunction — Harvestcategories-> normalized Topic keys (the thematic-clustering facet).harvest_cross_post_linksfunction — Harvest/posts/...markdown links -> (permalink, section anchor) pairs.harvest_relationsfunction — Harvest a note's relationships using its (detected or given) source profile.harvest_series_linksfunction — Harvest/series/...markdown links -> series keys (the membership signal).normalize_permalinkfunction — Reduce a post link to its bare permalink — the path AFTERposts/.slugifyfunction — Normalize a category/tag to a stable key (lowercased, separators collapsed).
cjm_markdown_decompose_core.sections
decompose_sectionsfunction — Decompose a body into orderedSectionNodes (heading-delimited).heading_anchorfunction — Slugify a heading to its anchor — the Pandoc/Quarto auto-identifier shape.
tests.test_extract_project
test_extraction_is_deterministicfunctiontest_first_sentence_takes_boundary_else_capsfunctiontest_index_linefunctiontest_index_md_identified_by_directory_permalinkfunctiontest_non_index_and_frontmatter_name_unaffected_by_index_rulefunctiontest_note_from_text_uses_frontmatter_name_as_slugfunctiontest_render_groups_by_category_in_orderfunctiontest_render_is_idempotentfunctiontest_render_onboarding_surface_coverage_augments_landmark_mapfunctiontest_render_onboarding_surface_is_deterministicfunctiontest_render_onboarding_surface_structure_push_and_landmarksfunctiontest_root_level_index_falls_back_to_dir_namefunctiontest_slug_falls_back_to_relative_path_when_no_namefunction
tests.test_ingest_graphproject
test_alias_map_heals_a_drifted_referencefunctiontest_both_books_converge_on_shared_facetsfunctiontest_corpus_graph_elements_countsfunctiontest_note_view_from_graph_node_dictfunctiontest_render_from_graph_nodes_matches_direct_renderfunctiontest_topic_and_series_nodes_are_deduped_across_notesfunction
tests.test_parse
test_extract_headingsfunctiontest_extract_wiki_links_dedup_order_preservedfunctiontest_extract_wiki_links_ignores_code_spansfunctiontest_parse_frontmatter_emptyfunctiontest_parse_frontmatter_handles_colons_and_nestingfunctiontest_parse_markdown_end_to_endfunctiontest_parse_markdown_frontmatter_raw_is_lossless_prefixfunctiontest_split_frontmatter_absentfunctiontest_split_frontmatter_separates_blockfunction
tests.test_relations
test_detect_profilefunctiontest_extract_drops_self_reference_cross_post_linkfunctiontest_harvest_aliases_to_permalinksfunctiontest_harvest_categories_normalized_dedupedfunctiontest_harvest_cross_post_links_with_anchors_and_code_strippedfunctiontest_harvest_relations_dispatches_by_profilefunctiontest_harvest_series_linksfunctiontest_memory_corpus_unaffectedfunctiontest_normalize_permalink_variantsfunctiontest_slugify_normalizesfunctiontest_yaml_date_frontmatter_is_json_safefunction
tests.test_sections
test_decompose_sections_order_levels_hierarchyfunctiontest_duplicate_heading_anchor_disambiguatedfunctiontest_heading_anchor_matches_quarto_slugfunctiontest_lossless_body_starting_with_heading_has_no_preamble_nodefunctiontest_lossless_no_headings_is_one_preamble_nodefunctiontest_lossless_preamble_is_level0_order0_nodefunctiontest_lossless_raw_spans_reconstruct_body_byte_exactfunctiontest_note_from_text_lossless_round_trip_and_frontmatter_rawfunctiontest_note_from_text_with_sections_emits_section_nodesfunctiontest_scope_a_carries_no_rawfunctiontest_section_text_is_verbatim_immediate_prosefunctiontest_structural_edges_membership_and_hierarchyfunction
tests_manual.memory_body_roundtrip
checkfunctionmainfunctionrunfunction
tests_manual.memory_roundtrip
checkfunctionmainfunctionrunfunction
Dependencies
Depends on: cjm-dev-graph-schema, cjm-substrate
Used by: cjm-context-graph-projection, cjm-notebook-decompose-core
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cjm_markdown_decompose_core-0.0.11.tar.gz.
File metadata
- Download URL: cjm_markdown_decompose_core-0.0.11.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
361f1a1cbb63c41ecb7b8ca1ab4e1a0eb5d79174453e0888eae6bb631dbdbc45
|
|
| MD5 |
0883664eaeab8dc345d17ba6f3af8028
|
|
| BLAKE2b-256 |
8b4001f99175593fc0ee7614d7b852041633ccee5af4f6e03d00e235bde8f56c
|
File details
Details for the file cjm_markdown_decompose_core-0.0.11-py3-none-any.whl.
File metadata
- Download URL: cjm_markdown_decompose_core-0.0.11-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8226444fa0c012da67762ca421f4ebe501d15901b5fe08cab1dd5ed95ae6d9ea
|
|
| MD5 |
4cc346c30eb8b388fc46bd6eb79219d9
|
|
| BLAKE2b-256 |
4961f3ae052a64ce716973213cc640829108253759d76e1d9e6bd71341377c90
|