vscode: Create rich content similar to what is in the Release Notes? - visual-studio-code

Visual Studio code has very nicely formatted release notes:
I'd like to create files that look this nice.
How is this done for VSCode? And, is it possible for me to generate a similar document (embedded images, formatting, hyperlinks) in VSCode? Or, do they use a 3rd party tool?

Yes, the release notes are just markdown converted to html that is rendered in a webview. You can use the built-in markdown preview to view markdown content in this way
If you are writing an extension that needs to show nicely formatted content like this, use the vscode.previewHtml command. This example extension provides an example of how to do this using TextDocumentContentProvider

Related

Is it possible to build a LibreOffice document from code similar to the way a web page is built from HTML and CSS?

Is it possible to build a LibreOffice document from code similar to the way a web page is built from HTML and CSS? Can one write an ODF file in which the content and styling are separate, and then/view open in LibreOffice? If so, can one write the code in a text editor as done for HTML/CSS?
There area two reasons I now ask. 1) When I need to make a style change in LibreOffice I have to manually make the same adjustments in a hundred places, such as changing the style of block quotes. 2) I'd like to build documents from a database of text.
I found a question on this in relation to databases but it was about eight years old.
Thank you for any direction you may be able to provide.
Unzip an .odt file that contains styles. You will see two files, content.xml and styles.xml. Edit these files using a text editor and then zip the folder back up to get a modified .odt file.
Be aware that there are two types of styles in the XML files. Named styles are what most people think of as styles, whereas automatic styles are custom formatting, like when you select some text and change the font directly.
The link from tohuwawohu describes utilities to work programmatically with the file. Also as mentioned in the link, it's not too hard to write code yourself. For example in python, import the built-in libraries zipfile and xml.etree.

Where can I find the code that converts PR descriptions into HTML

Pull requests' (PRs) descriptions use Markdown that's documented here, and when the PR is viewed in a browser, that Markdown content is converted into HTML and looks "pretty".
Where can I find the code that converts it from Markdown to HTML, so I can leverage the same algorithms in my (internal-only) code?
Unfortunately we can not see the source code. It should be something like the Markdown editor/viewer.
So if you mean you want to render the Markdown with the "pretty" formatting offline, then you can use the existing Markdown editor/Tools such as markdown-it or showdown or any others.
Showdown is a JavaScript Markdown to HTML converter, based on the
original works by John Gruber. Showdown can be used client side (in
the browser) or server side (with Node.js).
If you are interested in the codes, then you can reference the open source code of markdown-it or showdown on GitHub.
Other related questions:
How to render Markdown Text from database in a Razor view?

What is the correct way to import/require "vscode" inside the developer tools inside VS Code? [duplicate]

Is there any way to use variable vscode to get editor content just like Atom without writing Extension.
After getting editor content, I can do more things like:
Use Javascript to modify text literally
Custom format
vscode image
atom image
No. This is not supported.
You can use the extension API to extend VS Code. This API lets you get and modify editor contents

How to use variable vscode in Developer tools?

Is there any way to use variable vscode to get editor content just like Atom without writing Extension.
After getting editor content, I can do more things like:
Use Javascript to modify text literally
Custom format
vscode image
atom image
No. This is not supported.
You can use the extension API to extend VS Code. This API lets you get and modify editor contents

How do I view the source of Markdown files on Github?

Github helpfully renders Markdown (.md) files to HTML when viewing on github.com (for example, this README.md).
When viewing any other source file, it is shown as unrendered source code (for example, this .gitignore). A handy feature this gives is linking directly to a line in the source by clicking the line number (for example, like this).
How can I view the unrendered source of Markdown files on Github (so I can link to a particular line in the source)?
note: I know of the "Raw" button, however it does not provide any of the nice UI Github has.
If you don't want to use the "raw" button, you can (since June 2021) add ?plain=1 to your GitHub markdown file URL:
Appending ?plain=1 to the url for any Markdown file will now display the file without rendering.
As with other code files, it will also show line numbers, and can be used to link other users to a specific line or lines.
For example, appending ?plain=1#L52 will highlight line 52 of a plain text Markdown file.
Example:
https://github.com/git/git/blob/master/README.md?plain=1#L49-L51
Since Sept. 2021, there is a button which adds the ?plain=1 for you:
Use the "Raw" button. For instance, if you were looking at README.md there is a Raw button in the Navigation. This can be simple URL change (from blob to raw), but in this case becomes a separate link.
Edit: There is no "pretty" view for the Markdown source. There's the converted HTML view, the Raw view without the UI, and the Blame view. Only the Blame view provides you with the ability to link to a specific line within the source.
Edit 2: The other option is to use Anchors within the README.md. If you take the Installation title for example, you can directly link within the content of the Markdown file. Assuming you don't have anything hidden within the Markdown itself, this is closer still to solving your original question.
Using the "Blame" button, you are able to see the source of the Markdown (for example, like this).
Unfortunately, "Blame" comes with extra UI elements which make the source more cluttered.
Refined Github provides an additional "Raw" button to view the raw source and link to a specific line:
I ran into this issue, as a complete surprise to me, on a file with a .wiki extension. It appears that files with .wiki, .mediawiki, and .wikitext extensions are recognized and rendered as HTML, with a table of contents even. I guess it makes sense, what with GitHub projects having wikis and all.
That's nifty, but this one particular case, I really wanted the raw wikitext to be visible and copy-pasteable, not some rendered representation of it.
The only half-way solution I found was to use a bogus file extension that isn't one of the ones recognized by GitHub, and then a .gitattributes to tell GitHub how to syntax highlight it, e.g.:
*.wiki_ linguist-language=mediawiki
I'm not thrilled about this, but all the good extensions were already "taken" according to the languages.yml linked above.