Package: plover-markdown-dictionary
Plover Markdown DictionaryThis is a markdown file with embedded code blocks, in the style of literate programming. Each code block contains a YAML-like bit of text defining your entries.This project was borne out of a desire for a dictionary format with these features:easy to read and write by handsimple for non programmersallows commentseditable (add/update/delete) through the Plover interface, without losing commentsTable of ContentsInstallationGit versionStatusFor developmentFormatWhere to put your definitionsDefinition FormatCommentsRepeat definitionsGUI BehaviourAddingDeletingUpdatingConverting to/from other formatsExampleNotesAlternative dictionary formatsPerformanceWhy use(UPDATED)or(DELETED)tags?Why this definition format?ContributingInstallationInstall via the Plover plugin manager.Git versionOn thecommand-line(requires git):plover-splover_pluginsinstallgit+https://github.com/antistic/plover_markdown_dictionary.gitStatusThis plugin is experimental and might have some bugs. Feel free toopen an issueif you find one, and read the changelog when upgrading.For developmentgitclonehttps://github.com/antistic/plover_markdown_dictionarycdplover_markdown_dictionary
plover-splover_pluginsinstall-e.FormatIt's a Markdown file, so you can do all theMarkdown formattingyou like!Where to put your definitionsPut your definitions in code blocks.HRAOEUBG: like
TH: thiswhich in markdown looks```HRAOEUBG: likeTH: this```You can set the syntax formatting language to YAMLNote:Although it looks like yaml, it isn't yaml.TH/STEUL:this stillWORBGS:workswhich in markdown looks like```yamlTH/STEUL:this stillWORBGS:works```Code blocks defined as other formats will not be read as dictionary definitions. This makes it easy to comment out sections.KOPLT/-D: commented
OUT: outwhich looks like```textKOPLT/-D: commented
OUT: out```Inlinecode blocks are will not be read as dictionary definitions.Code blocks defined by indentation (e.g. 4 spaces) will not be read as dictionary definitions.Definition FormatThe basic format isSTROKES: translation. Both the left and right side of the colon are treated as strings, even though they may not be in YAML.#S: 12:2-T:the*UR:you areKWRE:yesYou can quote these if you wish to preserve syntax formatting'#S': '1'          # single quotes
'2': '2'
"-T": the           # double quotes
"*UR": you are
KWRE: "yes"There are some characters you will need to escape:SKW-T:\'# single quote characterKR-GS:\"# double quote characterHAERB:\## hash character on the right hand side'#-T':9# you should not escape the # in strokesPW-RB:\\# backslashR-R:\\n# newlineR*R:\\r# other newlineTAB:\\t# tabBut you might prefer to use quotes:SKW-T:"'"KR-GS:'"'# you can quote double quotes with single quotesHAERB:'#'PW-RB:"\\"# backslashes always need escaping, whether they're in quotes or notR-R:"\\n"# same with newlinesR*R:"\\r"TAB:"\\t"# and tabsS-PS:''# you'll need quotes for anything with starting or trailing spacesCommentsYou can use comments after entries. These must be on the same line, and they're denoted by a#symbol.K-PLT:comment# this is a commentRepeat definitionsYou should avoid specifying the same stroke(s) multiple times. If you choose to do this anyway, you should assign the same translation every time. The plugin will make a best effort to update all rows of the same chord when Plover updates or deletes entries.REPT:reptile# this is overridden and ignored by PloverREPT:repeatREPT:repeatREPT:repeat# it will only appear once in Plover, but we'll try to reflect changes everywhereGUI BehaviourNOTE: You shouldn't edit the file both in the Plover GUI and in your text editor at the same time, because it might lead to inconsistencies.If you have edited the file manually, you can reload it in Plover by unchecking and rechecking the box next to the dictionary, or reloading withCTRL+R.AddingWhen you add an entry within the Plover interface, a section is created at the bottom of the file and entries are added. If the section already exists (defined by a heading with the text 'Added via Plover' then a single code block at the bottom of the file), it will add to that block.Example of what you'll see at the bottom of the file:## Added via Plover```yamlTPHU:newSPWREUS:entriesTKPW:goHAOER:here```DeletingWhen you delete an entry, the line in the document is updated with a(DELETED)prefix and will be ignored when loading the dictionary in the future.Example of deletingTKHRAOET/PHE: delete meKP-PL:example(DELETED) TKHRAOET/PHE:delete me# this is ignored by PloverTEGT:textUpdatingWhen the translation is updated, the entry in the document is updated in place, and annotated with an(UPDATED)prefix for legibility; it is still read as normal by Plover.Example of changingKP-L: exampletoKP-L: excelKP-PL:example(UPDATED) KP-L:excelKPW-PL:exampleWhen the stroke is updated it is treated like a deletion of the old entry then the addition of the new one.Converting to/from other formatsIn the dictionaries list, select the dictionaries you want to convert.Right click, choose "Save dictionaries as...".Choose whether you want to create a copy of each dictionary, or merge into a new one.In the save file dialog, choose where to save the dictionary. To convert to JSON, save with the extension ".json". To convert to Markdown, save with the extension ".md".ExampleThis file is an example! You can see the raw markdownhere.It is equivalent toexample.json.NotesThis format is a work in progress and I'd love to get feedback on what works or doesn't work for you!Alternative dictionary formatsThere are other plover dictionary formats that allow comments, but all of them have something that means they don't fit my original goals (as of June 2021).formatcommentsExcelDropped support for keeping comments on changing translations (in the form of other columns) in version 1.0.0yamlDoes not support keeping comments, citing performance reasons. Yaml also has weird catches with strings, like needing "no" in quotes (otherwise parsed as boolean).rtf/cre (built-in support,better-rtf)The format is hard to read (personal opinion)hjsonDoes not support keeping comments on dictionary updatesPerformanceBasic tests with the plover main dictionary usingtime.pyon my laptop.I haven't tried very hard to optimise this, so it's probably possible to go faster.TestTimeLoad JSON0.44sLoad JSON + Save JSON1.15sLoad JSON + Save Markdown1.52sLoad Markdown1.48sLoad Markdown + Save Markdown2.36sWhy use(UPDATED)or(DELETED)tags?It's important that people know what's been changed so that they can make sure any description or comment stays up to date.This could have been done via a version control system like git, but git requires a learning curve that non-programmers might not be comfortable with. Since people are likely to have to update the surrounding comments anyway, I thought it would not be too much work to remove the tags.For those who are comfortable, you can always clone this repository, alterDELETED_PREFIXandUPDATED_PREFIXin./plover_markdown_dictionary.py, and install your local version withplover -s plover_plugins install -e ..Why this definition format?json does not support comments. hjson (& other json extensions) and yaml are are not performant enough to be viable (according to the people making the dictionary plugins. I haven't tried).This particular format was chosen to be easy to read and write. It looks very similar to the default json, but does not require quotes nor commas. One downside is that it's not easy to copy and paste between this format and the default json, but I haven't decided how important that is for the format yet.I've also gone for an unstructured format for metadata (comments and Markdown) since other formats (e.g. JSON) are probably better structured metadata.ContributingIf you have any questions or problems, feel free to open an issue! I'll also gladly take suggestions in the form of pull requests as well.