Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any tips for post processing the output of this code? #38

Closed
sdondley opened this issue Jan 29, 2022 · 3 comments
Closed

Any tips for post processing the output of this code? #38

sdondley opened this issue Jan 29, 2022 · 3 comments

Comments

@sdondley
Copy link

Thanks for this module.

Once the ruby script does its thing, I'd like to process the text some more. For example, I wish to convert hyperlinks to a youtube video to youtube's embed code. Is there some kind of hook or other method for doing this kind of thing?

@patrickdavey
Copy link
Owner

patrickdavey commented Jan 30, 2022

The short answer is "no", there certainly aren't any built in hooks to do this.

You can just embed raw html into your .md files and it will be placed verbatim into the HTML output. e.g. just place

<iframe width="560" height="315" src="https://www.youtube.com/watch?v=dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

into your .md and it will pop out the other end intact.

I don't think I want to stray too far from what vimwiki itself does. You'd also run into the problem of exactly what sort of embed to use (width, height etc). I guess you could pipe it on through to sed or something like that if you want to convert further.

If you want to propose (and build & test) a hook system then I'd be open to the idea. Alternatively I guess you could just fork this gem and build in your own processors :)

I'll leave this open for a few days, or, feel free to close it if you decide not to build the hook system :)

@sdondley
Copy link
Author

sdondley commented Jan 30, 2022

Thanks for getting back.

I found a way to do this. Basically, it's this:

  1. create your own html conversion script. make sure the script collects all the arguments passed to it
  2. tell vimwiki to use the custom conversion script with the custom_wiki2html setting
  3. in the custom script, make a call to vimwiki_markdown and pass the arguments along to it
  4. now have the script open the html file output by vimwiki_markdown in step 3
  5. make modifications to the html code
  6. save the code back to the same html file

@patrickdavey
Copy link
Owner

Ah nice work :) yes, that'd work perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants