Module notes
This module offers utilities to parse HTML content and extract links from it. It provides functions to identify and retrieve hyperlinks embedded within HTML documents, facilitating the processing of web content for various applications.
Functions
ParseHTMLTitle
func ParseHTMLTitle(content string) (string, error)
This function takes a string containing HTML content as input and returns the title of the HTML document. It also returns an error if the parsing fails or if the title cannot be found.
Parameters:
-
content: A string containing the HTML content to be parsed.
Returns:
-
A string representing the title of the HTML document.
-
An error if the parsing process encounters any issues or if the title is not found.
ParseHTMLLinks
func ParseHTMLLinks(content string) ([]string, error)
This function takes a string containing HTML content as input and returns a slice of strings, each representing a hyperlink found within the HTML. It also returns an error if the parsing fails.
Parameters:
-
content: A string containing the HTML content to be parsed.
Returns:
-
A slice of strings containing the extracted hyperlinks.
-
An error if the parsing process encounters any issues.
GetNotes
func GetNotes(dirPath string) ([]byte, error)
This function retrieves all notes from the specified directory path, creates a graph representation of the notes, and returns the graph in JSON format. It also returns an error if the retrieval process fails.
Parameters:
-
dirPath: A string representing the path to the directory containing the notes.
Returns:
-
A byte slice containing the JSON representation of the graph of notes.
-
An error if the retrieval or graph creation process encounters any issues.
GetNote
func GetNote(id string) ([]byte, error)
This function retrieves a specific note based on its unique identifier (UUID string). It returns the note’s content as a byte slice and an error if the retrieval fails.
Parameters:
-
id: A string representation of the UUID identifying the note to be retrieved.
Returns:
-
A byte slice containing the note’s content. This is usually the content of a HTML file.
-
An error if the UUID is invalid or the note cannot be found or retrieved.