Documentation ¶
Overview ¶
Package html includes methods for convert text/gemini to HTML.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateHTML ¶
GenerateHTML generates an HTML document representing the given Gemtext AST. It's behavior can be influenced using the config parameter.
Generated HTML elements will have class attributes according to what type of text/gemini element they were created from. The possible class values are:
- gemdown-error - diagnostic information created if invalid AST nodes were given as input.
* gemdown-text - generated from Text elements.
* gemdown-link - generated from Link elements.
* gemdown-heading - generated from Heading elements.
* gemdown-quote - generated from Quote elements.
* gemdown-preformatted - generated from Preformatted elements.
Preformatted nodes will have have their title attribute set to the alt text of the Gemini Preformatted elements.
Types ¶
type Config ¶
type Config struct { // Standalone will cause the HTML to include the necessary tags to act // as a valid, standalone HTML document. Standalone bool // DontEscapeHTMl disables automatically escaping any potential HTML // that might be embedded in the gemtext document. DontEscapeHTML bool // Style if non-empty, will be inserted into a <style> tag inside of // the <head> tag. Ignored if Standalone is false. Style string // DefaultStyle will cause a simple stylesheet to be inserted into the // generated document. If Standalone is false, or if Style is // non-empty, this flag is ignored. DefaultStyle bool // HeadInject if non-empty will be inserted inside of the <head> tag. // Ignored if Standalone is false. HeadInject string // tag. Ignored if Standalone is false. FooterInject string // IncludeStylesheets should be a list of URLs or relative paths to CSS // stylesheets to be included. Ignored if Standalone is false. IncludeStylesheets []string // IncludeScripts should be a list of URLs or relative paths to // Javascript files to be included. Ignored if Standalone is false. IncludeScripts []string // HideErrors prevents errors from being inserted into the generated // HTML. If not asserted, any errors will be created inside of <div> // elements with the 'gemdown-error' class. HideErrors bool // Language allows setting the lang attribute of the <html> tag. If // omitted, "en" is used. Ignored if Standalone is false. Language string // Title allows setting the contents of the <title> tag. Ignored if // Standalone is false. If omitted, the title is set to the value of // the first h1 level header in the document. If there is no first // level header, it is set to the first sentence in the document // instead. // // If you would like to prevent the title from being generated, // use the magic string '.notitle'. Title string // Description allows setting the description metadata content. // Ignored if Standalone is false. Description string // Description allows setting the author metadata content. // Ignored if Standalone is false. Author string // RewriteSpecs is a list of link rewrite specifications to be applied // during HTML generation. RewriteSpecs []*util.RewriteSpec }
Config represents configuration options for generating HTML.