Package: wikme
wikmewikmeis a Python package that allows you to convert a folder of Markdown files into a simple wiki-style website. It supports parsing and converting wikilinks, both regular and with custom titles, and includes additional features like last edited date retrieved from git log or file modification timestamp, depending on your needs.FeaturesConvert a folder of Markdown files into a simple wiki-style websiteAutomatically handles wikilinks and converts them to HTML anchor tagsSupports custom titles for wikilinksDetects last edited date, either from Git log or file modified timestampAllows users to provide their own HTML templates for a customized look and feelInstallationYou can install the package via pip:pipinstallwikmeUsageYou can use wikme package in your Python scripts as follows:fromwikmeimportmain# Define input and output directories and the template fileinput_folder="./markdown_files/"output_folder="./generated_html/"template_file="./template.html"main(input_folder,output_folder,template_file)You can also use it as a command-line tool:wikme--input"./markdown_files"--output"./generated_html"--template"./template.html"Arguments--input: Path to the input folder containing the Markdown files.--output: Path to the output folder where the generated HTML files will be saved.--template: Path to the HTML template file used for rendering the Markdown files.HTML TemplateYou can create a custom HTML template to style the generated files. The content of the Markdown files will be inserted into the designated placeholder.An example template:<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>{{ title }}</title><linkrel="stylesheet"href="pygment.css"></head><body><header><h1>{{ title }}</h1></header><main>{{ content }}</main><footer><small>Last Edited: {{ last_edited }}</small></footer></body></html>Placeholders:{{ title }}: Will be replaced with the title of the Markdown file.{{ content }}: Will be replaced with the HTML converted content of the Markdown file.{{ last_edited }}: Will be replaced with the last edited date of the file.Wikilinks SyntaxWikilinks are used to create links between pages within the generated wiki-style website. Thewikmepackage supports several variations of wikilink syntax.Regular WikilinksStandard wikilinks without custom titles:[[Page Name]]This syntax will create a link to the specified page with the same text as the page name.Example:[[Home Page]]creates a link to the "Home Page" with the text "Home Page".Wikilinks with custom titles:[[Page Name|Custom Title]]This syntax allows you to create a link to a page with a custom display text for the link.Example:[[Home Page|Visit our home page]]creates a link to the "Home Page" with the text "Visit our home page".Tilde-prefixed WikilinksThese are useful when you want to link to files outside of the input folder or link to a different directory assuming you are on a pubnix or tilde server.Tilde-prefixed wikilinks without custom titles:[[~path/to/page]]Example:[[~docs/section-01]]creates a link to the "/docs/section-01" page with the text "docs/section-01".Tilde-prefixed wikilinks with custom titles:[[~path/to/page|Custom Title]]Example:[[~docs/section-01|Section 1]]creates a link to the "/docs/section-01" page with the text "Section 1".NotesThe parser will process the wikilinks within your Markdown files and convert them into the corresponding HTML anchor tags.Syntax Highlighting and CSS GenerationThewikmepackage renders Github Flavoured Markdown. This is easily highlighted usinghighlight.js. Seetest_template.htmlfor an example.Syntax Highlighting in MarkdownTo enable syntax highlighting for a code block, you can use the the 4 space indent syntax with a language identifier. Here's an example:Check out this code:

    #!python
    msg = "Hello, world"
    print(msg)In this example, the language identifier ispython. This will tell thecodehiliteextension to apply syntax highlighting for the Python language to this code block.You can use any language identifier supported by thePygmentslibrary. A list of supported languages can be found in thePygments documentation.Generating CSS for Syntax HighlightingThecodehiliteextension uses thePygmentslibrary for syntax highlighting. To generate a CSS file for syntax highlighting, you can use thepygmentizecommand-line tool provided by thePygmentslibrary.First, ensure that you have the 'Pygments' library installed. You can install it usingpip:pipinstallpygmentsNext, you can generate the CSS file with the following command:pygmentize-S<style-name>-fhtml-a.codehilite>pygment.cssReplace<style-name>with the desired syntax highlighting style. Some popular style names includedefault,monokai,vs, andxcode. A list of available styles can be found in thePygments documentation.This command generates apygment.cssfile with the selected style applied to thecodehiliteclass. You can include this CSS file in your HTML template to enable syntax highlighting for your generated wiki-style website.LicenseMD GPL