-
-
Notifications
You must be signed in to change notification settings - Fork 334
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
Insert external image addin #269
Comments
This also should be easier than what I used to do at lcolladotor/markdown-redcarpet.tmbundle@f043c05 |
Yes! Yes!! Yes!!! That is absolutely the thing we need in blogdown, and WordPress can RIP after your PR! The last time you used your master branch to create the PR, which is good for a one-time PR, but not good for future PRs. In general, you should use different branches for PRs, and keep the master branch in sync with the upstream master branch here. Since you have already used master, the easiest option for you is to delete your blogdown repo, fork it from here again, make changes in a new branch, push the branch, and submit a PR. BTW, it looks like the "Great Hacker Award" worked? 😜 Did you receive the blogdown stickers? |
Hi Yihui, I'm glad that you are super excited about the insert image addin idea =) I followed your instructions (deleted repo, re-forked, made a branch, sent PR from branch) so hopefully it's all good. Compared to the code above, I simply reduced 10px the file chooser part of the addin. Best, PS I haven't received the stickers yet, I'll let you know when I do ^^. And yes, the great hacker award was motivating hehe =D |
Excellent! I sent you two: one with my signature, and obviously the other one was for your laptop (which is already on your laptop). |
Hehe yup, I did get both =) and took an image of the signed one. Thank for the note! Actually, that's not my laptop. It's the bookstand next to my monitor at work ^^ |
Hi Yihui,
I was about write an updated version of http://lcolladotor.github.io/2018/02/17/r-markdown-blog-template using the new changes from #263. I then realized that inserting external (non R images) takes enough work that it might scare off some users. This has been discussed in #239. I know that another option is to use
knitr::insert_graphics()
but then the user has to organize the pictures someway that avoids creating files atblogpath/content/post
. So I made an addin for inserting pictures that copies the selected file toblogpath/static/postdir/
and inserts the HTML code for showing a picture. I chose HTML since that should work with .md, .Rmd and .Rmarkdown blog posts + gives control on the width/height.What's the best option for submitting a PR? Should I delete my first fork at https://github.com/lcolladotor/blogdown and remake one? Some of the solutions at https://stackoverflow.com/questions/28119733/how-can-i-make-a-second-fork-of-a-github-project (a new account, forking to an organization) don't seem like the best to me.
Addin demo
Select addin from the addins menu
If the user didn't have a file selected (for example they had the console selected), end in an error with a useful message.
Addin after filling some options
Text is inserted, console prints the location of where the image was copied to. Useful if new users want to learn what is going on.
Addin code
Contents of
inst/scripts/insert_image.R
. It's based oninst/scripts/new_post.R
Changes to
R/utils.R
(around line 325)Changes at the end of
inst/rstudio/addins.dcf
Best,
Leo
The text was updated successfully, but these errors were encountered: