I use Jekyll Now for my blog
It uses Kramdown to parse Markdown, and to pass Math to MathJax
I want to use a counterfactual conditional like this
What is the best way to do this?
If you are using the STIX fonts, or the LatinModern or any of the other web fonts, you could do something like
\mathbin{\square\!\mathord\to}
I don't know what class this character is supposed to have, but I made it a BIN (binary operator) as an example. Change \mathbin to the appropriate value.
If you are using the default MathJax font, however, you might prefer
\mathbin{\lower.1em\square\!\mathord\to}
Whichever you prefer, you probably want to change your configuration to force the font you want, as the default configuration for HTML-CSS output allows either STIX or MathJax fonts.
Related
I am learning how to make README.md files stylish and easy to read. I am also trying to learn good coding, GitHub, and repository structuring practices.
I found that I could style README.mds using HTML. However, I am a bit confused about how HTML interacts with .md files.
For example, does <h1>Project Title</h1> work the same as #Project Title in a README.md?
Additionally, is it considered bad practice to use HTML to format a README.md? I noticed a lot of my friends repositories do not use HTML.
Thank you for your time and assistance.
Both <h1></h1> and # seem to work the same in README.md. However, I am worried I am not following standard practice or am making my README.mds incompatible with other markdown features (or something like that).
I am so new to GitHub that I can't tell if I am doing something wrong by using HTML. Thanks!
Typically, yes, a top-level heading is equivalent to h1. Markdown is designed to be a shorthand for HTML and so it has a lot of correspondence. In addition, you can embed HTML in your Markdown file to do things that Markdown itself can't.
However, having said that, if you're writing Markdown, it's best to use the Markdown features wherever possible. Those will be more familiar to people and generally more flexible, substantially easier to read in plain text, and in some cases, such as READMEs and documents on GitHub, certain tags, as well as JavaScript and CSS, are restricted for security purposes. In addition, if you're converting Markdown to another format with a tool like pandoc, much of that HTML won't transfer.
Thus, you'll have more success if you think about Markdown as an independent document language you use to write text, where you may, from time to time, embed HTML to do very specific things, rather than writing a full Markdown-HTML hybrid. When you think about using Markdown as a document language primarily for text, and not a language that has support for formatting documents (e.g. alignments, colours, layout, etc.), then it becomes easier to write Markdown documents that work in a wide variety of contexts. Since your README is designed to basically communicate ideas using text, perhaps with a few images, that approach will help you write more typical Markdown.
I am using jekyll to generate my site and markdown files for creating posts.
I wrote markdown code to generate http://techtaste.in/blog/markdown/markdown-quick-reference.html. And I have used same content in https://github.com/Raghavendrak555/chari.github.io/blob/master/testMarkdown.md. These two pages render differently. Former one does not has syntax highlighted and latter one has.
What I can do to get the same sort of display for a markdown file in my site, same as it display in the github site.
Do I have to link any specific CSS file to achieve this or any config settings are needed in _config.yml.
Thanks in advance.
Do I have to link any specific CSS file to achieve this
Yes, exactly.
First you need to specify the markdown renderer and its syntax highligher. I use this:
markdown: kramdown
kramdown:
syntax_highlighter: rouge
(I'm not sure if this is strictly necessary, but it's what I do and it works for me.)
The syntax highlighter wraps your code in a bunch of span elements with particular classes depending on what color it should be. (On GitHub, inspect the highlighted code to see what I'm talking about.) Then you need to include CSS files that specify colors for each of those classes.
To find these CSS files, do a google search for "rogue syntax highlighting css files" or "pygments css" (rogue and pygments use the same class names). Here is a good list, but according to this you might have to change one class name.
See also: Add syntax highlighting to gh-pages
I need to maintain many documents which need to be able to be viewed as 2 different types of format: PDF & HTML. The document will be mostly text, but may contain some images or mathematical formulas.
My current approach is to maintain 2 files for each document. However, this approach is tiresome, as if the content needs to change, I need to modify BOTH versions of the file.
I want to find a way to easily keep both versions of the file in sync. Preferably (but not necessary), the approach should allow me to use tools like git, or svn.
A solution that comes to my mind is to use latex. Represent the document in latex, then export it to HTML/PDF. This way, whenever there is a change, I need only to modify one file (the latex file).
But I have zero experience working with latex. I'm not sure whether latex is suitable for this, I need advice. What do you guys think? Is latex suitable for this task? If not, what alternatives do I have?
First of all,
yes, LaTeX is suitable for this (and it works particularly well with formulæ).
The main processing paths are:
Use pdflatex to create a pdf directly from LaTeX
Use latex2html or tex4ht to convert your LaTeX source to HTML
I am biased (having authored a text book for LaTeX in German language), but I think LaTeX is definitely worth learning.
restructuredText (Python docutils) is good for this. There are a couple of paths from text to PDF; one of them goes through LaTeX and the other one is a pure Python rst2pdf.
If you have a lot of formulas, it might be worth doing it in LaTeX, but restructuredText source is a lot more readable than LaTeX source.
Sounds like a good candidate scenario for working in markdown and using pandoc to convert to both LaTeX and HTML. Formulas can be essentially written in LaTeX (thus making the maintenance of that output painless) and the markdown-to-HTML conversion can be expressed with the --mathjax option to yield proper display in HTML.
I'd like to write my terms and conditions using a word processor, save it and easily embed the file in my Rails application. Nothing fancy, just have paragraphs, and bold (and regular) fonts. Which is a file format that can be easily used to display a formatted text with Rails? I don't want to have to deal with a lot of gems, dependencies, etc for some simple formatting.
Thanks.
I think you'll need to do normal html formatting, because all view files are .html.erb so I don't think you can copy your style/format from editors unless you have a html text editor.
I suggest that you should write it in a plain text and later add html tags for formatting, also by this method you don't have to deal with any gems or dependencies. You can also use css to make it better styled.
i'm not sure to explain what i'm looking for.
What's the name of the "source code parser" for publish code, in HTML ?
For example, when i write some source code here in stack overflow, system auto-detect the sintax and write "correct" source code in html.
I've noticed that exists the HTML <"code"> tag, but it simply write source code in "courier" font.
So i'm asking you if exists some "external" component that, given a text, parse it out correctly in a HTML page.
Thank you!
SO uses prettify to syntax highlight the <code> snippets.
Source: Which tools and technologies were used to build the Trilogy?
It is a JavaScript tool that scans a page for code snippets, and colours them on the fly. The downside of this solution is that it doesn't work with JavaScript turned off. Seeing as syntax colouring is not really an essential task, it is arguably a small downside.
The system is called Markdown and here is an explanation of the code blocks it uses.
For the syntax highlighting that you mentioned, a different system is used called prettify.
There are two components to this:
The CSS/HTML structure for syntax highlighting (e.g. styles for printing keywords, #s, strings, comments etc... in certain colors). This can be generic or per-language.
The code parser (grammar parser), which breaks the code up into tokens and labels the tokens with the appropriate classes. This can be implemented on either back-end via whatever language your back-end is in; or on front-end via JavaScript (the example of the latter is Google's Code Pretty which is used by StackOverflow).
It can be coupled with some heuristic logic to decide what language the code belongs to (and thus which grammar/parser to use).