API

This is a list of documentation associated with every single exported function or object from NoteMate.jl. There are a few different sections with a brief explanation of what these sections are followed by relevant functions.

Structs

These are the core objects used to represent various note species within NoteMate.jl. They are designed to be extended or parsed as needed:

NoteMate.FranklinNoteType
FranklinNote

Struct representing a Note to be deployed to a Franklin website.

A note headed for expression as a Franklin markdown and then a webpage requires additional metadata demanded by Franklin to execute the whole conversion, including information for the RSS feed.

source
NoteMate.NoteType

Struct representing a note in Zettelkasten

The generic Open Knowledge Model note with its key structures, isolated as single strings and some further metadata in appropiate types. Within the constraints of NoteMate this is the generic type to which any note from any specific format parses down, and from which other note structures for representation targets are build using templating functions.

source

Parsing

These functions are built to parse different sorts of files into NoteMate.jl objects (i.e. structs). Multiple sections exist to denote what markup languages are able to be parsed as of now:

Markdown

The parsing for NoteMate.jl supports Markdown – specifically, CommonMark Markdown is supported but support for other variants could be added in the future:

NoteMate.find_citation_groupsFunction

Given text and a regular expression that matches a citation group (e.g. pandoc, etc.), extract and return a vector of citation groups from within that text.

Arguments

  • text::String - text to be processed

Keyword Arguments

  • key_regex::Regex - regular expression to capture citation groups; default captures citation key groups of the form, [@citation] or [@citation_1; @citation_2]

Returns

  • Vector of strings with captured citation key groups
source
NoteMate.create_inline_citationsFunction

Given a list of citation key groups, create inline citations based on a given CSL and a bibliography provided in bibtex.

Arguments

  • citation_groups::Vector{String} - a vector of strings containing citation key groups

  • bibtex_path::String - path to a bibliography (.bib format supported)

  • csl_path::String - path a a CSL standard (i.e. .csl format)

Returns

  • Dict with keys as the original citation groups and values as their corresponding inline citation
source
NoteMate.create_referencesFunction

Given a list of citation key groups, create a reference list based on a given CSL and a bibtex bibliography.

Arguments

  • citation_groups::Vector{String} - a vector of strings containing citation key groups

  • bibtex_path::String - path to a bibliography (.bib format supported)

  • csl_path::String - path a a CSL standard (i.e. .csl format)

Returns

  • String containing an ordered reference list
source
NoteMate.find_markdown_linksFunction

Given text and a regular expression that matches a markdown link, extract and return a vector of markdown links from within that text.

Arguments

  • text::String - text to be processed

Keyword Arguments

  • key_regex::Regex - regular expression to capture markdown links; default captures markdown links of the form, [linked text](https:://duckduckgo.com)

  • group_links::Bool - a boolean that determines if the function should try to determine what kind of link a markdown link is (e.g. a website link, a relative file link, etc.) and returns a dictionary instead of a vector with only the links

Returns

  • Vector of strings with captured markdown links
source
NoteMate.create_relative_linksFunction

Given a list of strings denoting a markdown link of the form [text](link), update the link to a relative link format.

Arguments

  • link_strings::Vector - markdown links to be processed

Keyword Arguments

  • prefix::String - a prefix to add to each link; default is ""

Returns

  • Dict with keys as the original markdown links and values as their corresponding revised relative links
source
NoteMate.get_headersFunction
get_headers()

Finds all the MarkDown headers in a file's parse tree.

Arguments

  • contents: The Vector of content structs of a MD struct from Julia standard library Markdown.parse

Returns

The vector of all headers in the parsed Markdown document

source
NoteMate.get_sectionsFunction
get_sections

Separate a whole parsed Markdown document into blocks of the text between headers.

Arguments

  • contents: The Vector of content structs of a MD struct from Julia standard library Markdown.parse
  • headers: Vector of Header structs that are found in the submitted document

Keyword Arguments

  • name_sections = true: boolean setting to get a dictionary instead of a vector.

Returns

  • By default, a dictionary of the headers first word as key and the sections between the headers
  • A Vector of all section texts between the headers of the document
source
NoteMate.get_title_sectionFunction
get_title_section

Get the sections that sit underneath title headers.

Arguments

  • contents: The Vector of content structs of a MD struct from Julia standard library Markdown.parse
  • title_headers: Vector of Header structs that are considered title headers

Keyword Arguments

  • name_sections = true: boolean setting to get a dictionary instead of a vector.

Returns

  • By default, a dictionary of the title section under the "Title" key
  • A Vector of all section texts started by title headers
source

Targeting

After parsing a note into a NoteMate.jl object, these functions support translating each object into a specified target output. These targets are designed to quickly translate one's note to a publishable artifact for the internet (or other future supported platforms). The following sections denote functions that support a given target:

Franklin

Franklin.jl is a static site generator written in the Julia programming language. It uses its own variant of markdown called "Franklin Markdown" to assist in publishing content to the web:

NoteMate.create_franklin_noteFunction
create_franklin_note(note::Note; date_format::String = "U d y")

Transform a generic Note into a [FranklinNote](@ref) data structure with special metadata from Note content.

Arguments

  • note: a Note object that will be used for conversion

Keyword Arguments

  • date_format: a String that accepts a date format; default "U d y" (see: Dates.format for options)

Return

  • A newly prepared FranklinNote object
source
NoteMate.generate_franklin_templateFunction
generate_franklin_template()

Generates a template for a Franklin markdown page.

Keyword Arguments

  • title: Page title. Default is nothing
  • slug: Specifies web page url path (after base path). Default is nothing
  • tags: Keywords or tags associated with page. Default is nothing
  • description: Description of page contents. Default is nothing
  • rss_title: Page title that shows up on RSS feeds. Default is nothing
  • rss_description: Description that goes along with RSS updates. Default is nothing
  • rss_pubdate: Publication date for RSS feed. Default is nothing

These kwargs are "page variables" that come directly from Franklin.jl's documentation. For more specific details, please see Page Variables

Return

  • A String object that contains a valid Franklin template that can then be modified further

Example

If the following call is made: generate_franklin_template(; title = "All-Payer Claims Database", tags = ["apcd", "claims", "database"]), the following string will be returned:

+++

title = "All-Payer Claims Database"

tags = ["zettel", "apcd", "claims", "database", "archive"]

+++

This can then be edited or formatted further as needed.

source
NoteMate.generate_note_summaryFunction
generate_note_summary

Generate a note summary section using note title, publishing date, rss summary and any keywords.

Arguments

  • note: a FranklinNote struct whose information is formated for the note summary section

Return

  • a string formated according to the Open Knowledge Model standard for Franklin, starting with a note title, followed by the Date in monthname day year form, the RSS summary of the note, and comma-separated keywords for the note.

An example formating:

Example title:
=========

**Date:** May 12 2020

**Summary:** This is the summary of an example note

**Keywords:** example files, demonstration, documentation
source
NoteMate.generate_bibliographyFunction
generate_bibliography

Generate a bibliography section for a Franklin page.

Arguments

  • note: a FranklinNote struct whose bibliography string will be included in the output

Return

  • a string starting with a Fraklin section header, followed after a double newline by the bibliography string stored in the note struct.
source
NoteMate.generate_citationFunction
generate_citation()

Generate the citation string that can be used to reference the page of this document.

Arguments

  • note: a FranklinNote struct whose information will be used to format the citation strings

Keyword Arguments

  • citations : TODO clarify type and structure here

Return

Return string always begin with ## How to Cite\n\n followed by either:

  • if the citation argument is empty, returns a standard citation string with primary author name, note title, homepage link and monthname day year date.
  • if the citation argument is non-empty, will generate a longer citation string with list of all authors before note title, homepage link and monthname day year date.

FIXME: This is currently hardcoded for my own personal website. We need to adjust this to not be that way.

source
NoteMate.generate_referencesFunction
generate_references

Returns the references string for the note.

Arguments

  • note: a FranklinNote struct whose references string will be included in the output

Return

  • the note references string as is, without further formating
source
NoteMate.generate_commentsFunction
generate_comments()

Generates a Fraklin page macro to embed a comments section into a page.

Return

  • A string containing a Franklin macro to add comments to a Franklin page. See Franklin Utils for more information.
source

Miscellaneous

These functions are mostly for occasional use or do not fit cleanly into anyone section yet.

Missing docstring.

Missing docstring for sync_file. Check Documenter's build log for details.