feat: add typographer option for markdown preview (#119641)

Co-authored-by: Matt Bierner <matb@microsoft.com>
This commit is contained in:
William Desgardin 2021-03-29 23:18:59 +02:00 committed by GitHub
parent bfe889d3b9
commit 30ccdf6b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -207,6 +207,12 @@
"description": "%markdown.preview.linkify%",
"scope": "resource"
},
"markdown.preview.typographer": {
"type": "boolean",
"default": false,
"description": "%markdown.preview.typographer%",
"scope": "resource"
},
"markdown.preview.fontFamily": {
"type": "string",
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",

View File

@ -3,6 +3,7 @@
"description": "Provides rich language support for Markdown.",
"markdown.preview.breaks.desc": "Sets how line-breaks are rendered in the Markdown preview. Setting it to 'true' creates a <br> for newlines inside paragraphs.",
"markdown.preview.linkify": "Enable or disable conversion of URL-like text to links in the Markdown preview.",
"markdown.preview.typographer": "Enable or disable some language-neutral replacement and quotes beautification in the Markdown preview.",
"markdown.preview.doubleClickToSwitchToEditor.desc": "Double click in the Markdown preview to switch to the editor.",
"markdown.preview.fontFamily.desc": "Controls the font family used in the Markdown preview.",
"markdown.preview.fontSize.desc": "Controls the font size in pixels used in the Markdown preview.",

View File

@ -17,6 +17,7 @@ const UNICODE_NEWLINE_REGEX = /\u2028|\u2029/g;
interface MarkdownItConfig {
readonly breaks: boolean;
readonly linkify: boolean;
readonly typographer: boolean;
}
class TokenCache {
@ -187,7 +188,8 @@ export class MarkdownEngine {
const config = vscode.workspace.getConfiguration('markdown', resource);
return {
breaks: config.get<boolean>('preview.breaks', false),
linkify: config.get<boolean>('preview.linkify', true)
linkify: config.get<boolean>('preview.linkify', true),
typographer: config.get<boolean>('preview.typographer', false)
};
}