I am using the markdown editor and I have loaded Mathjax in all pages of my website.
I have realized that this line of latex works well:
$(u_1)$
However, this one does not work (basically latex does not work):
$(u_1,u_2)$
In order to make this work, I have to write something like this:
$(u\_1,u\_2)$
I have a similar problem here. This does not work:
$$M=\left(\begin{array}{cc}
a & b \\
c & d \\
\end{array}\right)$$
But this works:
$$M=\left(\begin{array}{cc}
a & b \\\\
c & d \\\\
\end{array}\right)$$
This is a common issue of mixing LaTeX-input with Markdown. From the MathJax documentation:
There cannot be HTML tags within the math delimiters (other than <br>) as TeX-formatted math does not include HTML tags.
And later:
Another source of difficulty is when MathJax is used in content management systems that have their own document processing commands that are interpreted before the HTML page is created. For example, many blogs and wikis use formats like Markdown to allow you to create the content of you pages. In Markdown, the underscore is used to indicate italics, and this usage will conflict with MathJax’s use of the underscore to indicate a subscript. Since Markdown is applied to the page first, it will convert your subscripts markers into italics (inserting tags into your mathematics, which will cause MathJax to ignore the math).
As other answers on SO (see the link at the top) point out, some markdown parsers are more aware of TeX-like syntax than others.
Related
I have a TCL code gist embedded in my own website. This page uses MathJax 2.7.5 configed with "TeX-MML-AM_CHTML". However, Mathjax strangely rendered the code between back-ticks in the comments of the code. For example, one line in the source code is (can be found here in gist):
# `testPrintFlag` : integer
The letters "int" were rendered by MathJax to a integration symbol (see here).
The gist code block appears like this., but the correct one should be like this. I'm wondering how I can fix this.
Thanks!
The configuration file TeX-MML-AM_CHTML includes the AsciiMath input processor, and AsciiMath uses back-ticks as its math delimiters. So all your back-tacks will cause AsciiMath to process their contents as math. If you aren't using AsciiMath input, you probably want to use a different configuration format, like just TeX-AMS_CHTML which only does TeX input (not MathML and AsciiMath, as in your original). That will be faster as well as it is a smaller file.
If you are using AsciiMath input, then you could configure it to use a different delimiter. See the documentation for details.
You could also configure MathJax to skip containers with certain class names (e.g., class="gist"). See the ignoreClass option for the asciimath2jax preprocessor at the link above. There is a similar one for the tex2jax preprocessor.
I am writing documentation that has steps for Windows, Mac, Linux.
I want to make it look like this HTML5 tabbed HTML5 example
there is support for HTML in gitlab markdown
There is a reference to a sanitation class that validates the inline HTML in gitlab marrkdown
My question is:
Recommendations to achieve the tabbed documentation. Is there a workaround for displaying CSS correctly in markdown?
how to make this work?
Simply insert the relevant HTML/CSS/JS into your Markdown document.
As Markdown's Syntax Rules state (emphasis in original):
Markdown's syntax is intended for one purpose: to be used as a format
for writing for the web.
Markdown is not a replacement for HTML, or even close to it. Its
syntax is very small, corresponding only to a very small subset of
HTML tags. The idea is not to create a syntax that makes it easier
to insert HTML tags. In my opinion, HTML tags are already easy to
insert. The idea for Markdown is to make it easy to read, write, and
edit prose. HTML is a publishing format; Markdown is a writing
format. Thus, Markdown's formatting syntax only addresses issues that
can be conveyed in plain text.
For any markup that is not covered by Markdown's syntax, you simply
use HTML itself. There's no need to preface it or delimit it to
indicate that you're switching from Markdown to HTML; you just use
the tags.
The only restrictions are that block-level HTML elements -- e.g. <div>,
<table>, <pre>, <p>, etc. -- must be separated from surrounding
content by blank lines, and the start and end tags of the block should
not be indented with tabs or spaces. Markdown is smart enough not
to add extra (unwanted) <p> tags around HTML block-level tags.
However, there is one down side to this:
Note that Markdown formatting syntax is not processed within block-level
HTML tags. E.g., you can't use Markdown-style *emphasis* inside an
HTML block.
Finally, there is the concern that you appear to looking to have this document hosted on a third party site (perhaps in a readme on Gitlab). Most third party sites who process and host Markdown documents (including Gitlab) run the output through an HTML sanitizer for security reasons (to avoid XSS attaches, etc). Therefore, you are likely to find that various required hooks in your HTML will be stripped out and it won't work. Of course, this won't be a problem on your own site where you have total control.
The solution was tried in readme.rd from the text processor used by Microsoft VsCode and commited to gitlab. In the attached picture there is the rendering. It was not as expected. Perhaps the functionality to have tabs will be available soon.
An alternative is "collapsible sections" in GitLab Flavored Markdown. Link to documentation: link
Editor : Sublime Text 3
Does anyone knows what is that red highlight in the image above?
PHP error? editor(Sublime) error? or something else?
I'm working on a PHP project.
This is a known bug in the way Sublime Text currently highlights & characters that are part of a URL. See https://github.com/sublimehq/Packages/issues/428 for a discussion about it.
Basically, the problem is that, in HTML, & characters can't normally be used on their own, they are supposed to begin a reference to an "entity"/character. In HTML & is represented by & which stands for "ampersand", the name of this character. However, as per the above discussion, it seems to be valid in some circumstances inside URLs.
There are a couple of ways to "fix" the problem yourself.
One would be to modify your color scheme to not highlight scope invalid.illegal.bad-ampersand.html, but this would affect legitimate invalid uses.
Another would be to override the HTML syntax definition that ST uses to not mark the ampersand as invalid when inside a href etc. (this is the offending line.)
Probably the easiest solution is just to use & in place of & in your hrefs for now.
Is there a way to define a syntax file in Vim that is essentially a "meta" layer on top of other syntax files? By this I mean that the file defines syntax highlighting regions, but all it does for each region is specify a different syntax file to be applied to that region. This is useful for PHP embedded in HTML, or any other sort of file mixing languages. I am aware that there are scripts that handle PHP and HTML together, but I don't think they do it in the manner I described. I'm interested in the general solution to this problem.
That's what :syntax include is for. With it, you can mark certain regions in the buffer, and apply the subordinate syntax in there. As long as the regions are clearly delimited and do not mix, this works pretty well. This is used for example in the HTML syntax to include JavaScript inside <script> tags, and Vimscript uses that for Perl, Python, and other integration languages. You'll find these scripts at $VIMRUNTIME/syntax/.
Alternative
My SyntaxRange plugin provides a different approach, where you can highlight certain regions with another syntax, without defining a separate new syntax. This is used for more adhoc markup, e.g. to highlight a Python snippet inside an HTML blog post, or to automatically highlight inline patches inside an email body.
Composite filetypes
Finally, there are add-on syntaxes that go "on top" of a main syntax. An example is cpp.doxygen. You cannot do that with arbitrary syntaxes, though; the script has to be specially written to support that.
This is very simple question but I unfortunately didn't get any clue to get rid from this error. I am writing a blog post about jquery ajax where I need to write a symbol $. I am using Mathjax for writing mathematical notation. As I write $ (for example $.getJSON), the Mathjax library decodes this as LaTeX commands. Anybody knows how to skip that $ character so that MathJax library behaves it as normal $?
By default, MathJax does not use the single dollar as a delimiter for in-line math (for exactly the reason you indicate), and so your configuration must be explicitly enabling it. See the text2jax dpcumentation for details of how this is done.
You have several options:
Remove the configuration that turns on dollar signs for in-line math. (This won't be good if you have already used them for in-line math in other posts)
Enable the processEscapes option so that you can use \$ to get a dollar without it being used as a math delimiter
If your blog allows you to enter raw HTML, you could use <span>$</span> to prevent MathJax from using the dollar as a delimiter (math can't contain HTML tags, so this dollar will not match up with another one, so won't be used as a delimiter).
Put your code examples inside <pre> or <code> containers, as MathJax (at least by default) doesn't process math within these. Your configuration may have changed that, however, so check the skipTags setting in your configuration.
Any of these should allow you to do what you need.