How to remove link in MD file? - gitlab

In my project on gitlab I have some text in *.md files that looks like URL link, e.g. "asp.net" and by default it processes as clickable link. I want it to be processed as regular text. How to do this?
Now I realize .md files process different ways in webpages. Dillinger.io render asp.net as link and stackoverflow and gitlab as plain text.

There are two ways:
put it between two back-ticks
`asp.net` => asp.net
Better Way
Put a ZERO WIDTH NON-JOINER character after the dot:
'‌' as you can see it is not visible. It is also called half-space character. It is usually used in Arabic texts to separate characters:
سلام => س‌ل‌ا‌م
You can use it like:
asp.‌net => asp.net (it is not a link)
‌ is the code for half-space character.

Related

Markdown tabs in GitLab Markdown

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

How do I escape an '#' in GitLab Markdown?

I often use '#' in directory names (because names that start with that character are sorted before names that start with a letter or number).
But if I try to write a path containing a name with that character in Markdown in GitLab it is rendered as a 'mention' (of a user or group). I don't want that. Presumably GitLab might also actually notify the user or group too – I definitely don't want that!
So how can I quote or escape the '#' so that it's rendered normally?
Combine tags for an HTML span with the relevant HTML character entity:
*C:\\<span>#</span>code\my-project*
*~/<span>#</span>code/my-project*
See:
Character Entity Reference Chart – HTML5 Reference – W3C
Wrap all directory names in code spans (single back-ticks). While this is bordering on opinion, many would argue that directory names (paths, URLs, etc.) should be marked up as "code". And if you do wrap them in code spans, then they will not be treated as a "mention".
A Windows path (`C:\\#code\my-project`) and a posix path (`~/#code/my-project`).
The above example gets rendered as...
A Windows path (C:\\#code\my-project) and a posix path (~/#code/my-project).

Data structure for a grammar checker for LaTeX sources

Let me start with acknowledging that this is a rather broad question, but I need to start somewhere and reduce the design space a bit.
The problem
Grammarly is an online app that provides grammar and spell-checking as a browser plugin. Currently, there neither exists support for text editors nor latex sources. Grammarly is apparently often confused when forced to deal with annotated text or text that is formatted (e.g. contains wrapped lines). I guess many people could use that tool when writing up scientific papers or pretty much any other LaTeX tool. I also presume that other solutions exist or will soon pop up that work similarly.
The solution
In principle, it is not necessary to support Grammarly directly in, e.g., emacs. It suffices to provide a convenient interface to check multiple source files at once. To that end, a simple web app could walk through a directory, read all .tex sources, remove all formatting and markup, and expose the files as an HTML document. The user could open that document, run Grammarly, and apply any fixes. The app would have to take the corrected text and reapply formatting, markdown, etc. to save the now fixed source file.
The question(s)
While it is reasonably simple to create such a web application, there are other requirements to be considered: LaTeX parsing (up to "standard" syntax) and a library like HaTeX could deal with parsing and interpretation. But the process of editing needs some thought. Presuming that the removal of formatting can be implemented by only deleting content, it should be possible to take a correction as a diff and reapply it to the formatted document.
In Haskell, is there a data structure for text editing that supports this use case. That is, a representation of text that can store deletions, find diffs, undo deletions, and move a diff accordingly? If not in Haskell, does something like this exist somewhere else?
Bonus question 2: What is the simplest (as in loc required) web framework in Haskell to set up such a web app? It would serve one HTML document and accept updated versions of the text files. No database is required.
Instead of removing and then adding the text formatting, you could parse the souce text into a stream of annotated tokens:
data AnnotatedChar = AC
{ char :: Char
, formatting :: String
}
The following source:
Is \emph{good}.
would be parsed as:
[AC 'I' "", AC 's' "", AC ' ' "\emph{", AC 'g' "", ...
Then, extract only the chars from this list, send them to Grammarly, and get back the result. Now, diff the list of annotated characters with the list of characters you got from Grammarly. This way, you only to deal with a list of characters, but keep the annotations.

VIM Convert Text to URL with Search/Replace

I have a document that contains long filenames, followed by a hyphen, followed by a description of the contents of the file. The files are all PDFs. I am converting this document into a page on our website, so that it has the filename, which should be a link to the file, followed by the description of the file contents.
I'm fairly versed in the basics of VIM, but advanced search/replace is something I'm lacking in. What I'd like to do is convert each filename into a link to that filename. For example:
WebAdapt_Prod_Int_10.1_Install.IIS7.2008R2.pdf - Step by step instructions for installing ArcSDE 10.1 for Oracle on the ‘Test’ environment, including configuration notes.
Should convert to:
WebAdapt_Prod_Int_10.1_Install.IIS7.2008R2.pdf - Step by step instructions for installing ArcSDE 10.1 for Oracle on the ‘Test’ environment, including configuration notes.
There are roughly 30 of these documents, so going line-by-line would be time consuming (though by the time I get a response I'll probably already have done it). I'd just like to know how to do this for the next time I'm given a big text file that needs formatting.
Thanks in advance!
Try this:
:%s!\v^\S+\.pdf!&!
Please note that the above doesn't try to do anything with HTML entities though. See the Vim Tips wiki for a possible solution if that's a concern.
Edit: The way this works:
:% - filter the entire file
s!...!...! - substitute
\v - set "very magic" syntax for regexps
^\S+\.pdf - match one or more non-spaces at the begging of line, followed by .pdf
& - replace with the link: & is the matched string (that is, the filename).

How to replace/remove specific strings from html file using Notepad++?

I've export my bookmarks from FF in to a html file but it's too huge and complicated, so I need to remove some firefox lines from it to make it more lighter and plain.
I can replace basic things in the Notepad++ but I guess I do need some operators for this and I have no idea how to make it work right.
For example here is the line from the file containing a link to Logodesignlove :
Logo Design Love
I need to remove all those tags I don't care about, like LAST_MODIFIED="1256428672", ICON_URI="bunch of digits" ICON="bunch of characters" etc.
And of course I need to remove all those tags in every link in the list.
So I was thinking like use something like "Find all tags LAST_MODIFIED="anynumbers" and replace it with nothing/remove it" - it doesn't work though.
Examle how it should like:
Logo Design Love
So far I removed LAST_MODIFIED and ADD_DATE lines thanks to Aleksandr. So LAST_MODIFIED="\d+" worked just fine. But ICON and ICON_URI are still there. I've tried ICON="\w+" - but it doesn't work. I guess it has something to do with the slashes.
Why look for what you don't want when it's easier to keep hold of what you do want and drop the junk?
(<A HREF=".*?").*?(>.*?>)
with
$1$2
Code edited to suit Notepad++ now I know it doesn't need the special chars escaped. Thanks Aleksandr.
Read up on using regular expressions (the java regex tutorials are a good start http://docs.oracle.com/javase/tutorial/essential/regex/), and try one of the online regex tools to help write and test it, such as this one http://gskinner.com/RegExr/
Eg, remove "LAST_MODIF..." with the regex LAST_MODIFIED="\d+"
Otherwise, you may want an XML-specific tool, or even write an XSL. However, I don't know much about that.

Resources