Skip to content

A tool for generating Mardkown pages from a GRAMPS genealogy database.

License

Notifications You must be signed in to change notification settings

plbrault/gramps-to-markdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gramps to Markdown

This tool allows to generate Markdown files for all individuals present in a Gramps family tree. These files can later be integrated into a website using any Markdown-compatible static site generator, such as Gatsby or Jekyll.

Prerequisites

  • Node.js version 16 or later
  • A Gramps XML file (with a .gramps file extension) exported from Gramps

Installation

npm install -g gramps-to-markdown

Usage

gramps2md inputFilePath [output directory] [options]

Examples:

gramps2md genealogy.gramps
gramps2md genealogy.gramps output
gramps2md genealogy.gramps output '{ "languages": ["en", "fr"] }'

Available options

Options are provided as a JSON object (e.g. '{ "languages": ["en", "fr"] }'). The following options are available:

Options Type Default Value Description
languages Array ["en"] The language(s) in which to generate markdown files. Currently, only English ("en") and French ("fr") are supported. If both languages are included, there will be 2 markdown files for every individual in the database, and the language codes will be appended to their names.
urlPrefix string "" A value to append at the beginning of the URLs of the links included in the markdown files. These links point to the pages of other individuals (for instance, an individual's parents or children). By default, the URL for a link contains only the name of the concerned Markdown file (for instance: "I0135.md").
urlExt string ".md" The extension to use (including the dot) in the URLs of the links included in the markdown files. This is useful to make sure that the links will still work once the Markdown files are converted to HTML files to be included in a website (in that case, you could set this option to ".html"). An empty string can be provided if no file extension should be included in the URLs.
includePrivateData boolean false Indicates whether or not data marked as private in the Gramps file should be included in the generated Markdown files.
addFrontmatter boolean false Set to true in order to include a Markdown frontmatter containing metadata at the top of each generated Markdown file. The frontmatter in each person's file will minimally include their ID and their preferred name.
extraFrontmatterFields object {} If addFrontmatter is enabled, this option allows to add custom data to the frontmatters of all files. For instance, providing "extraFrontmatterFields": {"siteSection": "genealogy"} will add a siteSection field with the genealogy value to every frontmatter.

This is an extra usage example using all available options:

gramps2md genealogy.gramps myWebsite/genealogy '{ "urlPrefix": "/genealogy/", "urlExt": ".html", "languages": ["en", "fr"], "includePrivateData": true, "addFrontmatter": true, "extraFrontmatterFields": {"siteSection": "genealogy"} }'

Output Example

This is an example of a Markdown file generated by this tool:

# **Brault, Alexis**

## Other Names

* **Breau, Alexis**

## Life Events  

* 🎂 Birth: **1721-09-22** in **Grand-Pré (Acadie), Kings County, Nouvelle-Écosse, Canada**  
* 🪦 Death: **1811-07-16** in **L'Acadie, Saint-Jean-Sur-Richelieu, MRC du Haut-Richelieu, Montérégie, Québec, Canada**  

## Parents

* 👨 Father: [**Brault, François**](I0362.md)  
* 👩 Mother: [**Comeau, Marie**](I0363.md)  

## Families

### With [**Barillot, Marguerite**](I0355.md)

#### Family Events

* 💒 Marriage: **about** **1750** in **Grand-Pré (Acadie), Kings County, Nouvelle-Écosse, Canada**

#### Children

* [**Brault, Charles**](I0290.md)

## Sources

* *Find A Grave - Millions of Cemetery Records*, [http://www.findagrave.com](http://www.findagrave.com)
  * [https://www.findagrave.com/memorial/122154467/alexis-brault](https://www.findagrave.com/memorial/122154467/alexis-brault)
* *WikiTree*, [http://www.wikitree.com/](http://www.wikitree.com/)
  * [https://www.wikitree.com/wiki/Breau-280](https://www.wikitree.com/wiki/Breau-280)

Such a file is generated for each person in the provided Gramps file. An individuals.md file containing a list of all individuals with links to their files is also generated.

An example of a website integration is available here.

License

Copyright © 2022 Pier-Luc Brault [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

About

A tool for generating Mardkown pages from a GRAMPS genealogy database.

Resources

License

Stars

Watchers

Forks

Packages

No packages published