How to make a GitHub README.md render - github

I have a README.md here but it is not showing up as rendered Markdown, it just shows the raw text. Does anyone know what I'm doing wrong here?
https://github.com/slothdude/soundcloud-groupme-bot/blob/master/README.md

There's no way to reliably detect a file's encoding. At the end of the day, it's a guessing game.
That particular file is stored in some strange encoding. Some editors (e.g. Emacs) seem to mostly open it successfully (though there are a few strange characters that might be whitespace), but don't know what it is. When I ask Emacs what encoding it's using I get no-conversion, which isn't very helpful.
Others, like Gedit, show what looks like a mixture of kanji and rectangular symbols suggesting unknown values.
Tools like file and enca seem to have no idea what it is:
$ file README.md
README.md: data
$ enca README.md
enca: Cannot determine (or understand) your language preferences.
Please use `-L language', or `-L none' if your language is not supported
(only a few multibyte encodings can be recognized then).
Run `enca --list languages' to get a list of supported languages.
Open it in a decent text editor (ideally the one you've used to author it) and save it as UTF-8, then commit that change. I suspect that this will fix its rendering on GitHub.

Related

How to paste text with links and formatting into VS Code like Obsidian?

If I copy the above text from Chrome and paste it into Obsidian, I get
People who code: we want your input. [Take the Survey](https://stackoverflow.com/dev-survey/start?utm_source=so-owned&utm_medium=announcement-banner&utm_campaign=dev-survey-2021)
[](https://stackoverflow.com/questions/ask# "dismiss")
But when I paste into VS Code or any other editor, I get
People who code: we want your input. Take the Survey
Video Reference: https://dsc.cloud/J/67968285.mov
How does Obsidian do it? How can I achieve the same in VS Code?
— — — — — — — — — — — — — — — — — — — — — — — — —
The Short Answer:
"        The VSCode editor does not support the feature you described, and VSCode will almost certainly never support any functionality that comes close to it. This is because of what VSCode is, and what VSCode does, which I will explain in detail below."
The Long Answer:
So VS-Code is a text-based editor, and its purpose is to be an environment that programmers can write their code in, therefore, people using VSCode are going to preform a long list of tasks which includes, but is not limited to:
interpret, compile, execute, debug, serve, share, save, write, read, document, and run code. Now here is the problem with adding the ability to paste arbitrary data types into VSCode. Having any type of data, other than standard text in a file that you plan on using to do one of the following (this is the very short list)...
compile,
execute,
debug,
interpret
parse,
serve,
...will cause a syntax error to be thrown.
When you can copy, and paste, text-formatting from an external source (like a webpage), there is an extremely high probability that some unwanted formatting data will get pasted into some program you've written, and the text's format-data will end up not rendering for what ever reason (theirs a million and 87 reasons why that would happen), and you end up getting syntax errors that you can't see, so you now have no idea where the error is, despite the error message saying line number 734 column 24. In a situation like this you will have an error message that makes no sense, and you will have to start deleting things to find the issue. all because it has text-formatting data intertwined with standard text-data, which you can't see. I hope I drew a clear enough picture for you.
Their are other tools called word processors that implement this feature. I constantly couple G-Docs with VSCode.
Crazy Enough, not all is lost
VSCode allows extensions to make custom editors. The Extension API used to create an editor (can be seen by clicking the link) lets developers build the UI using standard HTML, CSS, and JavaScript. This is enough for someone to write a Word Processor for VSCode, which surprisingly no one has done yet. When someone does create one, which I am almost certain that someone will eventually, in could support the feature your asking for.
For the record, the feature your describing is typically a word processor thing. VSCode allows you to install extensions such as PASTE, which copies and pastes other data types, however; when it is pasted into the editor, instead of rendering the data types like HTML, it just writes it in its text format. In other words, you might think your copying the page at first, but you will be disappointed once you paste to VSCode. I want to point out that Paste uses the GTK-3 Clipboards API, which means that if Paste were to be implemented in a word-processor, like word, or Google docs, those word processors would render the data the the Paste extension pasted into the word processor. In other words, it isn't the extension that is failing to render the Data (which as stated, can be done with the Paste Extension), but its VSCode that wonder render that data as HTML, but only accepts it as a standard text data type.
#W3Dojo
What you've copied can be considered "rich text", but VSCode treats everything in your clipboard as plain text.
So it's the same as pasting via "Ctrl+Shift+V" in other programs like Word or Google Docs. It will remove any formatting, links, color, font, bold/italic, etc.
Obsidian was built with formatting in mind - it closely follows the markdown specification, so it's natural that it will try to convert any rich text to markdown.
I'm not aware of a built-in VSCode setting that will allow you to paste rich text, but I've found 2 extensions that might do the trick:
Paste Special
Markdown Paste

Getting github to syntax highlight my files

github automaticall syntax highlights any code files such as those with .c extensions. And there seems plenty of information about controlling highlighting from within 'markdown' or .md files.
But how can I get it to highlight code files that it doesn't know about?
I can't even get the tabbing right - if I say 4-spaces tabs while editing, it goes back to 8-space ones when I've finished.
I don't care what highlighting style it uses even if it's the wrong language; it must be better than the plain text appearance which looks really flat. Oddly, when editing it uses some sort of highlighting, which again disappears when I've finished.
The files aren't in any well-known language so the highlighting won't be perfect; I just want a bit of colour. But I'd rather not change file extensions as that could be confusing.
The tabbing is done through a ?t=4 parameter added to the GitHub url.
But the syntax highlighting (using Rouge on GitHub pages for instance) itself is either:
set in fenced code block (but only for .md markdown pages)
or by changing the file extension (which you don't want)
But how can I get it to highlight code files that it doesn't know about?
Update Feb. 2021 (5 years later)
Nat Friedman (CEO of GitHub) announces it on Twitter:
Another tiny but nice improvement we just shipped to GitHub – syntax highlighting now works on new files without the need to commit first.

Any method to restore garbled/distorted text file by Matlab?

I got a very weird situation that highly needs your assistance. I appreciate your effort and time in advance.
I have a machine which produces a text file that records some information of the machine's working status such as, the coordinate of the drill head and the rotating speed used at that position. While we examine the text file, it appears to be unreadable because most of the contents are garbled. Please see the attached figure. http://ppt.cc/sA1I
If I open it with UltraEdit I see: http://ppt.cc/TrnV
As you can see some part of the file is readable; however many unrecognizable characters, which should be those numeric values we want.
Two reasons that I believe this problem should be solved by Matlab. First, I am sure this machine has many built-in matlab code inside for analysis purpose. Second, we have a .exe file, which is compiled by Matlab, can restore the garbled text file into arranged and readable format (the values of the coordinates are restored).
We desperately want to see the contents of this file by ourselves. Please kindly provide solution or idea or any direction for me to solve this issue.
Sincerely,
Old question without answer: For the record, a suggestion.
Sounds like a case of Mojibake, a problem with text encoding. Here's how I solved it.
Background: I had text files created on a Mac, others on a Windows, others still on Linux, each in different text encoding. So I got a text editor that would allow me to view the format and to change it. In my case, I used TextMate on MacOS, opened the files, picked the correct encoding upon opening, which sometimes was a Windows format, a Mac format, sometimes a Latin format -- had to use trial and error to figure it out based on a preview this particular piece of software gave me. Once I had the file opened in the correct encoding, I would save it in the utf-8format, which is not platform-specific and allows me to move my text files across various computers.
There may be more scalable methods, but I only had a hundred or so files to deal with, so I opted for the manual method, in order to personally visualize the rendering on screen, and because my files came in different encoding to begin with.

Looking for a Document Comparer that can generate difference reports

I've been using an application called "WinMerge" lately for document comparisons, but one of the requirements of my teams script files (for auditing purposes) is that when we release a revision of a script we highlight the changes in red (RTF format I believe, it's through Lotus Notes) To that end, is there any software that can automatically highlight changes for me or is the best I'm going to get a list of differences and be expected to manually highlight all changes?
Assuming an HTML+CSS solution meets your needs, this article from Linux Journal shows a shell script that reads diff output and writes an HTML document with colored text highlighting the differences.
On Windows, it would probably work as-is under bash as provided in the MSYS environment from the MinGW folk or in bash from Cygwin. The script itself isn't too large, I would imagine it could be ported to Perl with only a moderate effort.
Since converting HTML to RTF turns out not to have a trivial solution that I've found, you might have better luck porting the script to directly output RTF.
If an HTML report is acceptable, Beyond Compare can generate a comparison report that highlights differences. You can use the built-in stylesheets or a custom internal one to style the differences in red (the default is a light red color already).
It doesn't seem to be able to generate RTF, but perhaps there is a simple conversion between html/css and rtf.

looking for a UTF-8 text editor

I am looking for a (simple) text editor that can handle text in different encodings in the same document.
I need to develop some sites with mixed Japanese and English text and the editors I have now (on an English Windows system) are unable to display the Japanese text.
Jedit files don't display the Japanese text I have inputted but when I look at the file in a browser it shows up correctly.
Gvim shows all Japanese text in the editor as question marks and also in the browser.
In Gvim inputting the kanji works (you input the pronounciation and then press space bar to get the kanji) but when you confirm the kanji you want it replaces that kanji with question marks. (1 question mark for every kanji).
Can someone recommend me a text editor to edit html and php files that is able to display utf-8 encoded text and also save as an utf-8 file ?
thank you.
After reading about emacs I installed it. see below.
Thanks everybody for the hints.
if you don't have a unicode font yet you have to find one online or buy one.
here are the instructions to install the font on a windows system http://support.microsoft.com/kb/314960
jEdit
I changed my font in Jedit to a UTF font and now the Japanese shows up normally.
inputting the Japanese is still problematic as you don't see what you are typing.
(to change your font to edit files go to Utilities -> Global Options -> text area
select a Unicode font and you'll be able to see the Japanese characters.
gVim
I am still trying to figure out how to add a font in gvim. Once I know how to do that I ll update this.
Emacs
Emacs does not show the kanji correctly, they are displayed as ??? but at least I can see what I type in Japanese and select the right word.
so at this point I have to say that in jEdit I can see Japanese text but I can't input Japanese text. Gvim I can input Japanese text but inside the text area it is displayed as ??? and the same goes for Emacs.
adding a font in emacs and gvim is sadly enough not a trivial task.
At the moment I use notepad with the Arial unicode MS font and saving as UTF-8 file as my Japanese editor. Not ideal but at least it works.
Notepad++ is highly recommended.
Emacs correctly handles UTF-8 for me. (And of course, it can edit HTML and PHP files).
I would recommend Vim still. The problem you were seeing with questions marks is probably an issue with the font you were using. When displaying text that contains characters not in the currently language applications typically display them as empty boxes or question marks. See here for UTF-8 support in Vim.
This section of the Vim manual is also helpful, especially for setting up UTF-8 in Windows.
There is an issue with most Unicode-aware text editors: when you select a font, they stick to it. If the font does not include a glyph for a character, then the default substitution character (I believe U+FFFD, REPLACEMENT CHARACTER) is used.
In contrast, web browsers typically try to find a glyph for the characters they have to display among all the fonts provided by the system.
So, what you need, if you don't have the font "Arial Unicode MS" or similar (including Japanese glyphs), is an editor that tries to match glyphs with other fonts except the selected one.
Until someone provides a link for such an editor, I'll suggest a (somewhat extreme :) editor:
Install the latest stable python 2.x version for MS Windows (currently 2.6).
Include "idle" in the installation.
Start → Programs → Python 2,6 → Idle (Python Gui)
The "idle" editor is typically used to edit python code (and test it interactively in the Python shell). However, it can be used as a plain fully-Unicode-aware text editor, and when saving text including non-ASCII chars, it defaults to UTF-8 encoding.
Now, idle is based on Tkinter, which is an interface to tk, which is a gui library for tcl; tcl/tk, like web browsers, when asked to display a character for which no glyph is present in the widget font, it searches other fonts too.
However far-fetched this may seem, I really believe it would help; if no other solution helps you, give it a try.
Vim works fine for me as a UTF-8 text editor.
Firstly, you need a font that has the characters you are using. Choosing another text editor won't help you with this (unless it searches for other fonts for the correct characters when the font you are using doesn't have them). If you are using gVim, you can set the font like:
set guifont=Consolas
(This is not to say that Consolas is the font you want.) You probably want to put this in the .vimrc file so that it is always used.
Secondly, Vim needs to interpret the file as UTF-8, which it doesn't always automatically do. To make it do this, do:
set encoding=utf8
You can also see what encoding it is using with:
set encoding?
EmEditor is written by a Japanese company for exactly this purpose. It is a fine text editor with good performance/simplicity but pretty much all the features expected of a capable editor; I use it as my default when on the Windows platform, as well as for editing Japanese web page templates. It deserves to be better-known IMO; it is at least as good as, say, TextPad, but with full Unicode support.
Unfortunately it is not free, however you can find a free version of the old EmEditor 6 at sites such as download.com.
You can use just Notepad.exe with the "Arial Unicode MS" font (if all of your text is left-to-right, given the English windows version). Just Save as, select UTF-8.
In general, use your favourite editor with a font like "Arial Unicode MS". I mention this one because is the font with the greatest Unicode coverage I have seen,
Try BabelPad. Editing-wise, it's simple. Unicode-support-wise, it's awesome!
It sounds like maybe the problem with Jedit is the font - are you using a font that can display all the characters correctly?
To be more precise, Arial Unicode MS is a reasonable choice for a Unicode font that can display a wide range of characters across the range of languages. There are certain issues with it that can make it less than optimal for some languages used in isolation - this is why there are also language specific Unicode fonts included with Windows.
I've never had a problem with vim as long as I use a font that actually contains the characters I want. It needs to be a monospace font. :set enc=utf8 to get to utf8 mode. Then you can use :digraph command to get a display of available characters, and see how each is displayed.
To add a font, add it in Windows (Control Panel/Fonts/Add Font). If it's a monospace font, it will then show up in vin in /Edit/Font.
Just to add another one: I just checked that Programmer's Notepad 2 has some UTF-8 setting too.
(vim and emacs do just fine as well)
EditPlus seems to be an better option for UTF-8 as I have used it.
EditPad Lite and Pro fully support Unicode as of version 6. (Disclaimer: Those are my own products.)
If you get question marks, you're using an encoding that does not support Japanese characters. In EditPad, you can change the text encoding (Unicode, legacy code pages) via Convert, Text Encoding. You can set the defaults per file type in Options, Configure File Types, Encoding.
If you see squares instead of Japanese characters, select a Japanse font or Unicode font. You can do this in EditPad via Options, Font.
To type Japanese, simply install a Japanese keyboard driver in the keyboard settings in the Windows Control Panel, if you haven't already.
EditPad Pro has preconfigured file types for PHP and HTML.
Kate. and by extension, any other KDE program that uses Kate as an embedded KPart (KWrite, Quanta+, KDevelop). It handles lots of encodings, but i like to always use UTF-8. It also has a huge collection of syntax highlightings.
Try SciTE http://gisdeveloper.tripod.com/scite.html. It's just great ;)
For very basic UTF-8 multilingual text editing, I have had good luck with BabelPad (www.babelstone.co.uk): it's free, simple and robust and displays almost everything with no fuss. When the editing needs are more severe, I resort a lot to EditPad Pro, or occasionally Notepad++. For non-Unicode editing on Windows, I'm a TextPad user--my staff and I have probably spent about 200,000 hours in TextPad, with only occasional forays into NotePad2, MadEdit, jEdit, XML Copy Editor, and EPCedit. The latter two handle UTF-8 XML files well. All of the editors mentioned above are free except TextPad and EditPad Pro. Thanks to the person who suggested Emeditor. I'll try it out. --PFSchaffner
I like jEdit for it's ability to ident wrapped lines. Really nice when editing XML files. A word of warning though: It's Java, so it's not light fast, like you would expect a text editor to be.
Text codecs are fully supported. It distinguishes between text files with and without the header identifying the file format (byte order mark), calling them UTF-8 and UTF-8Y. This is something that I'm missing in other text editors.
Try EditPlus. It has specific support for HTML, syntax highlighting and can also work as a simple IDE for any compiler.
On the Mac: SubEthaEdit has excellent support for character encodings.
TextPad is a good utility too. It's a trialware, but does the job fine. See how to set char-encoding-setting-in-textpad.
For japanese, Sakura Editor is exceptional. It can display UTF-8, EUC-JP, SJIS and so on.
http://www.ultraedit.com/ is a multiplatform editor that does UTF-8 and all kinds of conversions between formats
EditPad Pro ... is recommended for u
cheers ;)