Author SHA1 Message Date
Jared Howland 97c5f12b86 fix: rename frontmatter FamilySearch_ID
Make FamilySearch ID field name more consistent with the other fields in the frontmatter
2026-04-16 15:15:33 -06:00
Jared Howland a56792ae0d test: Gedcom file with no FamilySearchID
Added a negative-case assertion
to ensure get_fs_id returns an empty string when an Individual lacks the _FSFTID
tag
2026-04-16 15:08:15 -06:00
Jared Howland 14cd8beadc feat: add FamilySearch ID to frontmatter 2026-04-16 13:47:59 -06:00
AlexKucera 48e339c119 Updates license badge and text to GPL-3.0
The project has switched from the MIT license to the GNU
General Public License v3.0. This change updates the license
badge in the README and the corresponding license text to
reflect this change.
2025-11-03 10:43:50 +01:00
AlexKucera 9b3c63c2c4 Adds canvas visualization feature
Introduces the `--canvas` option to generate an Obsidian Canvas file,
providing an interactive visual representation of family trees.

Explains the generational layout algorithm, root person selection,
limitations, and tips for optimal results.
2025-11-03 10:41:18 +01:00
6 changed files with 88 additions and 2 deletions

No files matched your search

+61 -2
View File
@@ -7,7 +7,7 @@
**Convert GEDCOM genealogy files to Obsidian-compatible markdown notes with WikiLinks** **Convert GEDCOM genealogy files to Obsidian-compatible markdown notes with WikiLinks**
[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/) [![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg)](LICENSE)
[![Tests](https://github.com/AlexKucera/gedcom-to-markdown/actions/workflows/tests.yml/badge.svg)](https://github.com/AlexKucera/gedcom-to-markdown/actions/workflows/tests.yml) [![Tests](https://github.com/AlexKucera/gedcom-to-markdown/actions/workflows/tests.yml/badge.svg)](https://github.com/AlexKucera/gedcom-to-markdown/actions/workflows/tests.yml)
[![Codecov](https://codecov.io/gh/AlexKucera/gedcom-to-markdown/branch/main/graph/badge.svg)](https://codecov.io/gh/AlexKucera/gedcom-to-markdown) [![Codecov](https://codecov.io/gh/AlexKucera/gedcom-to-markdown/branch/main/graph/badge.svg)](https://codecov.io/gh/AlexKucera/gedcom-to-markdown)
[![CodeRabbit Reviews](https://img.shields.io/coderabbit/prs/github/AlexKucera/gedcom-to-markdown?utm_source=oss&utm_medium=github&utm_campaign=AlexKucera%2Fgedcom-to-markdown&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit)](https://coderabbit.ai) [![CodeRabbit Reviews](https://img.shields.io/coderabbit/prs/github/AlexKucera/gedcom-to-markdown?utm_source=oss&utm_medium=github&utm_campaign=AlexKucera%2Fgedcom-to-markdown&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit)](https://coderabbit.ai)
@@ -183,6 +183,65 @@ Stories are linked from person notes using WikiLinks, making it easy to navigate
The `Index.md` file at the root contains an alphabetical listing of all individuals with WikiLinks to their person notes. The `Index.md` file at the root contains an alphabetical listing of all individuals with WikiLinks to their person notes.
## Canvas Visualization
The `--canvas` option generates an **Obsidian Canvas file** that provides an interactive, visual representation of your family tree. This creates a `.canvas` file in your output directory that can be opened in Obsidian for a graphical view of family relationships.
### How It Works
The canvas generator uses a **generational layout algorithm** that arranges family members spatially:
- **Timeline Layout**: Ancestors appear to the right, descendants to the left, creating a left-to-right timeline
- **Vertical Positioning**: Family members are arranged vertically with gender-aware positioning to minimize relationship line crossings
- **Automatic Tree Building**: Uses breadth-first search from the selected root person to build the family tree
- **Disconnected Families**: Automatically detects and includes unconnected family groups as separate sections
- **Visual Elements**:
- Each person appears as a card/node with their name and basic information
- Person images are embedded in the canvas nodes when available
- Parent-child relationships shown as lines connecting left to right
- Spouse relationships shown as bidirectional vertical connections
### Root Person Selection
When using the `--canvas` flag, you can specify the root person in several ways:
```bash
# Interactive selection (displays numbered list)
python src/main.py -i family.ged -o output --canvas
# By selection number
python src/main.py -i family.ged -o output --canvas --root 85
# By GEDCOM ID
python src/main.py -i family.ged -o output --canvas --root @I253884714@
```
The root person serves as the starting point for building the family tree visualization.
### Limitations and Known Issues
While the canvas generator creates a useful visualization, it has some limitations:
1. **Spacing Approximations**: The algorithm calculates node positions using heuristics for spacing. Complex family structures (many siblings, multiple marriages) can sometimes result in:
- Nodes positioned slightly too close together
- Occasional minor overlaps between adjacent cards
2. **Manual Adjustments Expected**: In most cases, **a few nodes may overlap slightly**, but these overlaps are typically minimal and **can easily be fixed by hand** in Obsidian by dragging the nodes to better positions.
3. **Complex Marriages**: Individuals with multiple marriages may have relationship lines that cross in non-optimal ways.
4. **Large Trees**: Very large family trees (100+ individuals) may require manual adjustment for optimal viewing.
5. **Edge Routing**: Connection lines between nodes use straight lines, which can sometimes cross through other nodes in complex family structures.
### Tips for Best Results
- Start with a central family member (grandparent or parent) as the root person
- For large families, consider creating multiple canvas files focused on different branches
- Use Obsidian's zoom and pan features to navigate large canvases
- After initial generation, spend a few minutes adjusting any overlapping nodes for a cleaner layout
- The canvas is fully interactive - you can reorganize it to suit your preferences while maintaining all the relationship connections
## Project Structure ## Project Structure
```text ```text
@@ -267,7 +326,7 @@ pytest -v
## License ## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
## Acknowledgments ## Acknowledgments
+12
View File
@@ -56,6 +56,18 @@ class Individual:
""" """
return self.element.get_pointer() return self.element.get_pointer()
def get_fs_id(self) -> str:
"""
Return the FamilySearch Tree ID (`_FSFTID`) if present.
Returns:
str: FamilySearch Tree ID value, or an empty string when not available.
"""
for child in self.element.get_child_elements():
if child.get_tag() == "_FSFTID":
return child.get_value() or ""
return ""
def get_names(self) -> Tuple[str, str]: def get_names(self) -> Tuple[str, str]:
""" """
Return the individual's first and last name with surrounding whitespace removed. Return the individual's first and last name with surrounding whitespace removed.
+3
View File
@@ -123,8 +123,11 @@ class MarkdownGenerator:
birth = individual.get_birth_info() birth = individual.get_birth_info()
death = individual.get_death_info() death = individual.get_death_info()
fs_id = individual.get_fs_id()
f.write(f"ID: {individual.get_id()}\n") f.write(f"ID: {individual.get_id()}\n")
if fs_id:
f.write(f"FamilySearch ID: {fs_id}\n")
f.write(f"Name: {individual.get_full_name()}\n") f.write(f"Name: {individual.get_full_name()}\n")
# Lived years # Lived years
+1
View File
@@ -41,6 +41,7 @@ def sample_gedcom_content():
1 NAME John /Doe/ 1 NAME John /Doe/
2 GIVN John 2 GIVN John
2 SURN Doe 2 SURN Doe
1 _FSFTID G123-ABC
1 SEX M 1 SEX M
1 BIRT 1 BIRT
2 DATE 1 JAN 1950 2 DATE 1 JAN 1950
+10
View File
@@ -80,6 +80,16 @@ class TestIndividualBasicInfo:
"""Test gender extraction.""" """Test gender extraction."""
assert john_doe.get_gender() == 'M' assert john_doe.get_gender() == 'M'
def test_get_fs_id(self, john_doe, sample_gedcom_file):
"""Test FamilySearch Tree ID extraction from _FSFTID tag."""
assert john_doe.get_fs_id() == 'G123-ABC'
parser = GedcomParser(sample_gedcom_file)
individuals = parser.get_individuals()
jane = [ind for ind in individuals if 'Jane' in str(ind.get_name())]
jane_doe = Individual(jane[0], parser.parser)
assert jane_doe.get_fs_id() == ''
def test_get_gender_default_unknown(self, sample_gedcom_file): def test_get_gender_default_unknown(self, sample_gedcom_file):
"""Test that missing gender defaults to 'U'.""" """Test that missing gender defaults to 'U'."""
gedcom_content = """0 HEAD gedcom_content = """0 HEAD
+1
View File
@@ -129,6 +129,7 @@ class TestMetadataFormatting:
# Check for YAML frontmatter metadata # Check for YAML frontmatter metadata
assert 'ID: I1' in content assert 'ID: I1' in content
assert 'FamilySearch ID: G123-ABC' in content
assert 'Name: John Doe' in content assert 'Name: John Doe' in content
assert 'Sex: M' in content assert 'Sex: M' in content