Make inserted image fit content div in blogdown - r-markdown

In this blog post the author is using images that are larger a larger size than is displayed. When I use the RStudio addin to put a large image, on the other hand, it is inserted as-is and overflows the text box.
Apart from the addin, I have tried using knitr::include_graphics, but the result is the same.
Example:
The above post was created with this code:
---
title: image test
author: ''
date: '2019-01-17'
slug: image-test
categories: []
tags: []
---
Image below overflows text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width text width.
![](https://forestry.io/uploads/2018/01/hugo-vs-jekyll-advanced2.png)
```{r, echo = FALSE}
knitr::include_graphics("https://forestry.io/uploads/2018/01/hugo-vs-jekyll-advanced2.png")
```
(only one of the images is shown in the picture but both methods produce the same outcome)

Related

Setting the line spacing to 1.5 pt in R Markdown

I am writing my thesis in r markdown and I need a line spacing of 1.5 pt for this. Is there any way to modify the line spacing in markdown? Output will be pdf.

Markdown: continue text in list after a nested list

I need to insert a sub-list in a list and then continue the text in the item:
1. Start of the item text
- First item of sublist;
- Second item of sublist;
More text of the first item.
2. Second Item
3. Third item
The text after the nested list is not aligned correctly after rendering (should be aligned with "Start", is aligned with "1."). Any suggestion?
The text should be left-aligned with the text after the number, then the rendered text will be aligned to it.
Here is your example:
1. Start of the item text
- First item of sublist;
- Second item of sublist;
More text of the sublist of the first item.
The pending text of "More text of the sublist of the first item."
More text of the first item.
The pending text of "More text of the first item."
2. Second Item
3. Third item
The first line text have two chars: 1 . with one space before the text conent Start of...
Then the text you wants to aligned should also have 3 spaces before the text content of More text of...
Moreover, having <=N spaces (N presents the length of the prefix text of the list context, in this example, N=3) before the text content will make the content aligns with this list text
e.g.
Having 1 ~ 3 spaces will make the text aligns with the 1st line text, having 4 ~ 6 spaces will make the text aligns with the 2nd line text,

Is the VBScript RegEx Flavor Lookaround Method known to have problems with textfiles exceeding 5MB?

I would like to know why the following RegEx's:
\b\w{7}\b\s[1]\s[\S\s]+?(?=WHAT WHERE WHAT WHERE WHAT\,\sWHERE\sWHAT.)
and:
\b\w{7}\b\s[1]\s[\S\s]+?(?=WHAT WHERE WHAT WHERE WHAT\,\sWHERE\sWHAT.|HOW WHO HOW WHO HOW\,\sWHO\sHOW\.)
seem to work perfectly fine on the following test string:
THIS THAT THIS THAT THIS,
THAT
THIS.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
WHAT WHERE WHAT WHERE WHAT,
WHERE
WHAT.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
HOW WHO HOW WHO HOW,
WHO
HOW.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
IF OR IF OR IF.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
TO FOR TO FOR
TO FOR TO FOR.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
IN UNDER IN
UNDER IN UNDER.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
LEFT RIGHT LEFT
RIGHT LEFT.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
UP DOWN UP DOWN UP
DOWN.
CHAPTER 1
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 2
Text text text 2 text text text 3 text text text 4 text text text.
CHAPTER 3
Text text text 2 text text text 3 text text text 4 text text text.
THE END.
But, when I use the same type of Expression on files that exceed 5MB, it fails.
The VBScript that I am using is as follows:
Option Explicit
Dim strPath : strPath = "myFile.txt"
If Instr(1, WScript.FullName, "CScript", vbTextCompare) = 0 Then
With CreateObject("WScript.Shell")
.Run "cmd.exe /k cscript //nologo """ & WScript.ScriptFullName & """", 1, False
WScript.Quit
End With
Else
With CreateObject("Scripting.FileSystemObject")
If .FileExists(strPath) Then
Call Main(strPath)
Else
WScript.Echo "Input file doesn't exists"
End If
End With
End If
Private Sub Main(filePath)
Dim TempDictionary, Books, Book, b
Set TempDictionary = CreateObject("Scripting.Dictionary")
Set Books = RegEx(GetFileContent(filePath),"\b\w{7}\b\s[1]\s[\S\s]+?THE SECOND BOOK OF MOSES")
If Books.Count > 0 Then
For Each Book In Books
WScript.Echo Replace(Left(Book.Value,70),vbCrLf," ")
Next
Else
WScript.Echo "Document didn't contain any valid books"
WScript.Quit
End If
End Sub
Private Function GetFileContent(filePath)
Dim objFS, objFile, objTS
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.GetFile(filePath)
Set objTS = objFile.OpenAsTextStream(1, 0)
GetFileContent = objTS.Read(objFile.Size)
Set objTS = Nothing
End Function
Private Function RegEx(str,pattern)
Dim objRE, Match, Matches
Set objRE = New RegExp
objRE.Pattern = pattern
objRE.Global = True
Set RegEx = objRE.Execute(str)
WScript.Echo objRE.Test(str)
End Function
Editor that I am using is here: http://www.regexr.com/
Q: What are you trying to do?
A: I want to be able to split any textfile into several string chunks, based on a smart regex code that captures anything between two strings. The first string determiner is a fixed term, i.e. "CHAPTER 1", but the second string determiner is unfixed. The second string determiner is unfixed and changing, but it is known. It can be placed into an array, and then parsed.
The problem that I am having is that the Lookaround (?=) seems to either escape or get stuck in a loop. I have been playing around with the "|" operator, as you can see in the second RegEx at the start of this OP.
The test file that I am working with seems to parse just fine. No problem. But the larger files that I am working with... I don't know. Something just goes wrong.

Append items of a list to each line in Notepad++

I have a list of items that looks like:
White
Green
Blue
Yellow
Black
I'd like to append each item above to these lines of text:
Line One:
Line Two:
Line Three:
Line Four:
Line Five:
So that the final outcome is:
Line One: White
Line Two: Green
Line Three: Blue
Line Four: Yellow
Line Five: Black
My actual list is a couple hundred lines long. Is there a way to do this in Notepad++ with regex?
Might be faster to paste the columns into any old spreadsheet and then copy it back to a text editor.

Format text file on OSX to tab delimited text file

I have a file that looks like the following, which is outputted from a program i wrote in applescript.
AXTitle: Blah
AXSize: Width: 300
AXSize: Height: 44
AXPosition: X: 217
AXPosition: Y: 170
AXHelp: Blah
AXValue: Value, On
AXEnabled: true
AXFocused: false
AXRole: AXStaticText
AXRoleDescription: Blah
AXTopLevelUIElement: Blah
AXWindow: Blah
I need to put into a format that will be compatible with a database. So a tab delimited format. This is the format i would like to output it in. I don't need all the data above just what i select
123 456 0 1 2 3 4 5 text text
123 456 0 1 2 3 4 5 text text
I am thinking regular expressions to format text as i need.
Can i do this in applescript? If not what programs should i look at considering i am woking on OSX? sed, gawk, perl, python? Can i insert these programs in my applescript program or will i have to run separately?
When you are getting your selected items, just add the tabs as you go. You can also put the items into a list, where you can use text item delimiters to convert to a string with tabs between the items.
set X to {123, 456, 0, 1, 2, 3, 4, 5, "text", "text"}
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, tab}
set {X, AppleScript's text item delimiters} to {X as text, tempTID}
X --> result
Here is a good tutorial:
http://www.grymoire.com/Unix/Sed.html
set xxx to "Here is my input"
do shell script "echo " & xxx & " | sed 's/my/your/'"