Live preview of markdown using GitHub with VSCode - html

I'm trying to set the CSS file that I'd like Visual Studio Code to use when using a preview rendering of the markdown file I'm working on so that the style mirrors the GitHub style CSS... but so far unable to do it.
I get that VSCode uses the same CSS that matches what VSCode uses, but I'd like it to instead use GitHub's CSS. I've tried saving the CSS file from GitHub onto my system and then referencing the full path to that CSS within the settings.json file using the instructions here: https://code.visualstudio.com/Docs/languages/markdown#_using-your-own-css
But it isn't taking effect it seems... is this actually working in VSCode? I'm using the latest version 0.7.0.
updated
Here's how I have it setup. Within my workspace I have a file .settings/settings.json that contains:
{
"markdown.styles": ["github-markdown.css"]
}
Then I have the CSS file located in .settings/github-markdown.css. I've tried using the contents of the following two CSS files...
https://github.com/sindresorhus/github-markdown-css
https://gist.github.com/tuzz/3331384
...but neither is having any impact. I've also tried a fully qualified path tot he CSS file and relative (./github-markdown.css). Between each change, I've also restarted VSCode to see if that had an impact.

Paths to markdown styles will be resolved relative to the root of your workspace. I can get markdown styling to work with the following steps:
add an entry to the workspace settings "markdown.styles": [ "styles.css" ]
create a top level styles.css file and add a simple rule body { color: red; }
create a markdown file or open an existing one and preview it
The text of the markdown should appear in red.
If you are using CSS classes with a specific prefix, you have to make sure that those classes are in your markdown code. VSCode is not adding CSS classes by itself.

VSCode has it's own CSS for markdown rendering.
C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\markdown\media\markdown.css
This is the main reason why custom CSS does not apply.
I've override some attributes and it works well now.
I've uploaded codes to my github repository.
I hope this helps you.

If you want to use that file "https://github.com/SepCode/vscode-markdown-style/blob/master/preview/github.css", we know that "https://raw.githubusercontent.com/SepCode/vscode-markdown-style/master/preview/github.css", the URL is not working.
I have a good idea, we can use Github Pages.
Add a submodule in your repository, like this "git submodule add https://github.com/SepCode/vscode-markdown-style.git". And now we can use the URL "https://sepcode.github.io/vscode-markdown-style/preview/github.css" set markdown.styles.
Step:
clone your GitHub pages "git clone https://github.com/SepCode/SepCode.github.io.git"
cd SepCode.github.io
git submodule add https://github.com/SepCode/vscode-markdown-style.git
git commit -am 'added vscode-markdown-style module'
git push
setting vscode setting.json
{
"markdown.styles":["https://sepcode.github.io/vscode-markdown-style/preview/github.css"]
}
the vscode-markdown-style repository is just an example, we should use ourself's CSS file. This way is more convenient and controllable.
https://github.com/microsoft/vscode/issues/76384#issuecomment-507101841

Related

How do I make my style.scss(#import “variables “, #import “globals”, and #import “header”) to communicate with my stylesheet?

Im trying to learn sass and JavaScript using VS Code. I created an app folder that holds my js folder which contains my script.js and scss folder that contains my _globals.scss. _header.scss, _variables.scss, and style.scss. I created a dist folder that contains my style.css and style.css.map. I have my html linked to my dist/style.css but I cannot get any of my pages to connect to my html page. I have the #import variables, globals, and header set in my style.scss page but the only styles I can add to my webpage is from the html document itself.
I’ve tried very little because I’m new to web development. Working from a MacBook, I downloaded homebrew, git, and a couple other apps I saw on YouTube. I tried changing my #imports to #use and adding them directly to the style.css but that did not help.
I was expecting by downloading any of those files would get my pages to communicate with each other.
Are you trying to import the .scss files on your styles.css? If so, this is not the right way to work with sass.
To be able to "transform" the .scss files into .css, you have to compile these files using the CLI (command-line/terminal).
This video shows how to do this procedure.
It the above is not the case, could you please send us screenshots of what you're trying to do, it will be really helpful to help you to fix this issue.
Create a new file in CSS(type),
then link that file using the <link> tag in your HTML page using the address of the newly created .css file.

Error in creating website on GITHUB PAGES

I have made my project with bootstrap, html and css. But the Github pages are only showing the readme file and sending me the error mail. Please help me, this project is important for me
First of all, index.html is missing from your repository.
If you have used only Bootstrap, CSS, and HTML, you probably don't even need npm. You can just upload your files (including those folders for images and CSS) and then go to your Repository Settings and in Github Pages, set the source. If you have an index.html, then <username>.github.io/repo-name will render it automatically after a successful build.
You might find this repository which was made using HTML, CSS, Bootstrap (and Javascript) helpful to refer to.
PS: Don't push node_modules on GitHub. You should ideally add that folder to .gitignore. These modules can be installed by the user who clones your repo using npm commands.

Require a CSS file in an HTML file without using webpack

I am working on an Electron project and using Electron-packager to package my app.
However, with my current folder structure, all CSS files located in the parent folder of my Electron project/package.json are not being copied to the packaged application.
This is my structure:
- GUI
--- CSS
- Apps
---Demo
------package.json, etc
---Demo2
------package.json, etc
---Demo3
------package.json, etc
I build apps while inside Demox folder. Problem is I can't move GUI folder to inside Demo/Demo2/Demo3 since it will contain just the same files and it would be redundant.
However, electron-packager does not support packaging of files from outside the actual Demox folder.
It was suggested that I move these CSS files to node_modules instead.
But how do I require these CSS files from the node_modules folder to an html file? Is there any other way WITHOUT using webpack? I'm hoping to keep this simple and stay away from setting webpack up unless I have no other choice.
For reference, here is the question I posted on the Electron-packager github:
https://github.com/electron/electron-packager/issues/1089
Thanks!
Was able to come up with a solution now.
Since I have moved node_modules folder to the very root (C:\node_modules, so it can be used by all node projects residing in C: drive), I just used an absolute path and link from there:
<link rel="stylesheet" href="/node_modules/sample-css/button.css">
Works well for my needs.
Thanks everyone.

auto complete intellij - less/css

I have some problems with css auto complete on my html files.
My project is java project on spring/bootstrap. I have less file that is compiled to css later on. On my html files I don't have access to classes from less or bootstrap files. I have "webapp" folder configured correctly in project.
CSS files are in:
a) webapp\css\less\main.less
b) webapp\css\ (bootstrap, main.css main.min.css)
Is it possible to add css (class) completition to html files that are created in project?
It should do it out of the box for css: http://www.jetbrains.com/editors/html_css_editor.jsp?ide=idea
for LESS however you might need to use a plugin : https://plugins.jetbrains.com/plugin/7059?pr=idea
I know LESS works out of the box with WebStorm and PHPStorm, though
If it still doesn't work, you might need to set the right file extension or associate that file with a certain interpreter

How can I add a downloadable file to my Github.io page?

I have set up my professional website/homepage using Github Pages. I know if this was just HTML being served up from somewhere, my downloadable file would need to be in the directory of my .html file, and then I could reference it in the .html file and link it up. However, since this is served by Github through repository, I am unsure on how to do this.
Do I put my downloadable file in my repo under version control like the rest of the project?
If so, what path do I use in the .html file?
Also, I am aware that the Automatic Page Generator makes it possible to hardly touch the HTML, but it seems pretty restrictive as far as customizing where links and other content appears on your page...
You could just link it normally in your html. Commit it to your repository and have users right click to save.
I just tried this on one of my repositories where I put a link to my CSS file.
style.css
I was able to right click the link and download the file.
If you wanted to create a download from the root you would do:
Download File
I'm pushing my repositories manually instead of using the Automatic Page Generator. The steps are pretty straight forward Creating Project Pages Manually - GitHub Help
Since it is done in GitHub pages. It can also be done like this (in markdown fashion): [download]({{ site.baseurl }}{% link file.txt %}). It has the advantage to work locally without pushing the file to the repo.