Description:
- I am trying to integrate a workflow and tools which incorporates vimwiki and Gollum. I want to merely add vimwiki as an extention type for the editor while being processed by Gollum's internal Markdown processor (see "Things I've tried" #1).
- Eventually I'd also like to have Gollum default to 'vimwiki' when creating new documents as well.
- The project I'm working on can be found at Vimwiki-Gollum-Integration
Testing Specifics:
- Gollum version: 4.1.1
- The file being tested is valid github markdown
- The same content is being tested with different filenames and extensions:
- testx.thing
- blah.vimwiki
- The test files do work fine when they are named with .md extensions
- relevant rendering gems installed:
- github-markdown
- github-markup
- kramdown
- redcarpet
- All code is being tested in a gollum --config file
- I'm not well versed in ruby
Things I've tried
- Creating a new extension and custom renderer
- This works except there is no reason to implement a custom processor (pandoc)
- This would be ideal so that the Markdown name ends up in the Edit page. However, I don't think I should have to involve pandoc here
- How in the heck do I get the edit page to default the markdown to vimwiki when editing a vimwiki extension?
- file used: blah.vimwiki
# always include this:
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
################### custom extension + renderer
# # Custom extension rendering
# ## References
# * file reference: /var/lib/gems/2.1.0/gems/github-markup-1.6.0/lib/github/markup/command_implementation.rb
# * [Adding Pandoc to Gollum - Martin Wolf's weblog [OUTDATED]](https://www.mwolf.net/2014/04/29/adding-pandoc-to-gollum/)
ci = ::GitHub::Markup::CommandImplementation.new(
/vimwiki/,
["Vimwiki"],
"pandoc -f markdown-tex_math_dollars-raw_tex",
:vimwiki)
# bind your own extension regex (the new set of extensions will also include `.asc` and `.adoc`):
# # * file reference: /var/lib/gems/2.1.0/gems/github-markup-1.6.0/lib/github/markups.rb
Gollum::Markup.register(:vimwiki, "Vimwiki")
Gollum::Markup.formats[:vimwiki][:regexp] = /vimwiki/
GitHub::Markup::markup_impl(:vimwiki, ci)
##################
- Attempt to replace the Markdown primary extension and regex.
- I don't understand why this isn't working unless I'm misunderstanding the order of operations for matching and overrides.
- The page will display, the extension is recognized, but the page does not format at all -scrunches everything together.
# always include this:
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
# Attempt to replace the primary extension for Markdown
# remove the original markdown binding:
Gollum::Markup.formats.delete(:markdown)
# and define your own
Gollum::Markup.formats[:thing] = {
:name => "Markdown",
:regexp => /thing/
}
- Attempt to just replace the markdown extension regex
- Same result as attempt 2.
- The page will display but it is not formatted correctly
# always include this:
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
Gollum::Markup.formats[:markdown][:regexp] = /vimwiki|thing/
I'm closing the question:
As it turns out there is no way easy way to use the markdown processor and also get the edit page to recognize that there is a different extension. The markdown processor requires the extension to be valid it it's regex of extensions found in markdown.rb.
The bottom line is that I would need to implement something similar to what pandoc is doing anyway. So I'm just going just drop the subject and stick with pandoc -'Things I've tried #1' from the original question.
Rather than take a bunch of space here I've posted the documentation on the project page with code examples
Thank you to whomever spent some time thinking about this.