I have the following markdown code
<pre>
┣━━ 📦 t_databases - this is text
┃ ┗━━ MongoDB-Go.md - this is text
┗━━ t_webdev
┣━━ editor-Swagger.md
┗━━ packages-Go.md
┗━━ MongoDB-Go.md
</pre>
This looks like this:
How can I make this is text perfectly in line? Is there a programmatic way? Doens't seem to work if I just use tab key.
Related
I need to include the following code in a .tex file that is generated from a custom template via RMarkdown, in order to get rid of an error. However, if I try it as below in the YAML heading:
header-includes:
\newenvironment{CSLReferences}%
{}%
{\par}
it gets parsed into the .tex file as single line, like \newenvironment{CSLReferences}% {}% {\par}, thus commenting out everything after %. So how can I change the YAML part so that it correctly gets interpreted as 3 different lines?
Instead of worrying about the markdown parsing, you can write the command in a single line:
header-includes:
\newenvironment{CSLReferences}{}{\par}
Alternatively avoid all these annoying problems with markdown parsing and put your definition in a .tex file which you can include via
includes:
in_header: header.tex
After some trials & searching this works (found a solution while writing the question):
header-includes:
- "\\newenvironment{CSLReferences}%"
- "{}%"
- "{\\par}"
Interestingly, I couldn't find much in the official documentation.
EDIT:
As #samcarter mentioned in the comments & an answer, in this particular case a single line would've been enough, as
header-includes:
\newenvironment{CSLReferences}{}{\par}
A process takes a file in markdown format, parses it with pandoc to AST, changes some words in the text, and writes the resulting pandoc structure back to a markdown file.
This works except that the metadata which is included in the original file and is parsed by the pandoc input (extension: Ext_yaml_metadata_block is set) but is not included in the markdown output (extension there is only writerSetextHeaders).
What additional extension are needed? Or, do I need a different output template, including
something like $Meta$ (with the --- before and after)? Pointers to a solution greatly appreciated.
Should a template like this work?
$if(meta)$
---
$Meta$
---
$endif$
$if(titleblock)$ $titleblock$
$endif$ $for(header-includes)$ $header-includes$
$endfor$ $for(include-before)$ $include-before$
$endfor$ $if(toc)$ $table-of-contents$
$endif$ $body$ $for(include-after)$
$include-after$ $endfor$
It sound like you are missing the -s/--standalone flag (optStandalone in Haskell). Without this option pandoc just outputs Markdown snippets, not a full document.
I want to add an image (an html file called "Logo.html") at the top of another html document.
for that i use "before_body":
I save my Logo.html in the same file as my Rmarkdown and i get the following error when "kniting" my rmd:
pandoc.exe: Logo.html: openFile: does not exist (No such file or directory)
is there a specific place to put my "Logo.html"? do you know what is incorrect in my code?
output:
html_document:
include:
before_body: Logo.html
fig_caption: true
code_folding: hide
You must be careful with the indentation and nesting of the YAML parameters.
This works for me:
---
output:
html_document:
includes:
before_body: Logo.html
fig_caption: true
code_folding: hide
---
I'd like the output from asciidoc to look something like it does in the terminal. I could attach a screenshot as image, but I think highlighting the text is preferable.
// asciidoc source file
[source,XXX]
----
/home/neale/.zcompdump:670:4:'mhpath' '_mh'
/home/neale/.zcompdump:855:4:'pmpath' '_perl_modules'
/home/neale/.zcompdump:858:5:'podpath' '_perl_modules'
/home/neale/.zcompdump:1151:7:'tracepath' '_tracepath'
/home/neale/.zcompdump:1152:7:'tracepath6' '_tracepath'
/home/neale/.zcompdump:1482:11:'-value-,*path,-default-' '_directories'
/home/neale/.zcompdump:1483:11:'-value-,*PATH,-default-' '_dir_list'
/home/neale/.zcompdump:1484:23:'-value-,RUBY(LIB|OPT|PATH),-default-' '_ruby'
----
Is there some value of XXX that looks something like this? I have highlighting working for other languages (with local styles) generating pdfs (via a2x)
I've been playing with a script that takes the selected text in Chrome and looks it up in Google, offering the four top choices, and then pasting the relevant link. It is pasted in different formats depending on which page is currently open in Chrome - DokuWiki format with DokuWiki open, HTML with normal websites, and I want rich text for my WordPress WYSIWYG editor.
I tried to use pbpaste -Prefer rtf to see what a rich-text link with no other styling looked like on the pasteboard, but it still outputs plain text. After saving a file in Text Edit, and experimenting, I came up with the following
text = %q|{\rtf1{\field{\*\fldinst{HYPERLINK "URL"}}{\fldrslt TEXT}}}|
text.gsub!("URL", url)
text.gsub!("TEXT", stext)
(I had to use the gsub, because somehow when using %Q and #{} to insert the variables, the string didn't work)
This works, however, when I paste it, there is an additional lineshift before and after the link. What would the string look like to avoid this?
From the shell the clean solution is this:
URL="http://www.google.com/"
NAME="Click here for Google"
echo "<a href='$URL'>$NAME</a>" | textutil -stdin -format html -convert rtf -stdout | pbcopy
So, use the textutil command to convert correct html .. into rtf...
ruby variant:
url = 'http://www.google.com'
name = 'click here'
system("echo '#{name}' | textutil -stdin -format html -convert rtf -stdout | pbcopy")
so, when you run the above without pbcopy part, you'll get:
{\rtf1\ansi\ansicpg1250\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\froman\fcharset0 Times-Roman;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue238;}
\deftab720
\pard\pardeftab720\ql\qnatural
{\field{\*\fldinst{HYPERLINK "http://www.google.com/"}}{\fldrslt
\f0\fs24 \cf2 \ul \ulc2 click here}}}
EDIT: Just tested this on BigSur and working as should. Any HTML is got converted to rtf. Another demo (without variables)
echo '<b>BOLD TEXT</b><br>stackoverflow link<br><h1>big title</h1>' | textutil -stdin -format html -convert rtf -stdout | pbcopy
after pasting into TextEdit yields
One way of doing this is using MacRuby, which is able to directly access the pasteboard through the Cocoa framework, rather than using the command line tool, which gives you more options.
For example, you can use this function to paste in HTML code, including hyperlinks, which will function correctly inserted into TextEdit or a WordPress editing box:
framework 'Cocoa'
def pbcopy(string)
pasteBoard = NSPasteboard.generalPasteboard
pasteBoard.declareTypes([NSHTMLPboardType], owner: nil)
pasteBoard.setString(string, forType: NSHTMLPboardType)
end
This works much better than the command-line pbcopy, in that it definitively avoids adding white-space, and also avoids having to send RTF for rich text, where HTML is much easier to generate programmatically.
macOS's pbcopy command can detect RTF. The following example (using pandoc to convert markdown to RTF), places a rich text snippet in your paste buffer:
echo '**foo**' | pandoc -t rtf -s | pbcopy