Coder Social home page Coder Social logo

yzhang-gh / vscode-markdown Goto Github PK

View Code? Open in Web Editor NEW
2.8K 2.8K 322.0 7.89 MB

Markdown All in One

Home Page: https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one

License: MIT License

TypeScript 95.93% CSS 0.05% JavaScript 3.76% Rust 0.27%
markdown vscode

vscode-markdown's People

Contributors

alshain avatar andy-dihong-luo avatar arcticlampyrid avatar dependabot[bot] avatar ericyd avatar falsecross avatar karbassi avatar kongdd avatar lemmingh avatar linsui avatar peaceshi avatar pierremarchand20 avatar prazdevs avatar quanticle avatar raphaelsander avatar rbolsius avatar rfverbruggen avatar serhioromano avatar spmeesseman avatar stefanz8n avatar thomaskoppelaar avatar tianyishi2001 avatar tombresson avatar upupming avatar vhquang avatar vladislav-lyuminarskiy avatar wasdee avatar yy0931 avatar yzhang-gh avatar zkirkland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-markdown's Issues

Reuse npm modules from built-in markdown extension

Happened to see this article. Good comments!

reuse npm modules

// extension host makes it always accessible to extensions:
var vscode = require('vscode');  

//...

const getMarkdownPlugin = function () {
    const extension = vscode.extensions.getExtension("Microsoft.vscode-markdown");
    if (!extension) return;
    extensionPath = path.join(extension.extensionPath, "node_modules", "/");
    const named = require(extensionPath + "markdown-it-named-headers");
    const md = require(extensionPath + "markdown-it")()
        .set({ html: true, breaks: true, typographer: true })
        .use(named);
    return md;
}; //getMarkdownPlugin

const md = getMarkdownPlugin();

// now we can use md to render HTML

//...

claim built-in markdown extension as dependencies

"extensionDependencies": [
    "Microsoft.vscode-markdown"
]

Why is markdown.extension.orderedList.marker defaulted to 'one'?

Not an issue just a discussion on convention. Why is the default "markdown.extension.orderedList.marker": "one" when naturally most people would think ordered list are increasing in order? Either way I don't see why someone would use "one" (inspire me)

This behavior is very weird to me:

1. Item 1 #press enter 
1. Item 2

Of course I can just change the setting. But default settings should functional, convenient, conventional, and then popular opinion.

List Continuation Support for Task List

For

- item1

It's very convenient to get this when hit return

- item1
- 

But for

- [ ] task 1

hit return can only get

- [ ] task 1
- 

It would be very desirable to get this

- [ ] task 1
- [ ]

Respect option `editor.tabCompletion`

From #49 @ketozhang

tab should only refer to listing environment such that:

# snippet tabCompletion is active here but not listing tab

* Item 1
    * Item 1a  #listing tab is active here but not tabCompletion

Since we override the tab key, we need to handle all cases by ourselves. The current behavior is

if (inListEnv) {
    exec('indent')
} else {
    exec('tab')
}

We can change it to

if (inListEnv && someConditions) {
    exec('indent')
} else if (otherConditions) {
    exec('editor.action.triggerSuggest')
} else {
    exec('tab')
}

I am a little busy recently, will return to it in several days.

Ordinary list whose first item looks like the first heading is detected as TOC

When I have a header with a list beneath it containing links it seems to think it is a TOC (marking it as not up to date) and regenerating a TOC in place on saving. You should be able to save without it creating TOC's.

Example:

## Tasks
- [A task](http://link-to-task)
- [Another task](http://link-to-another-task)

On saving this is replaced by a TOC of the entire document.

Edit
Got it disabled using:
"markdown.extension.toc.updateOnSave": false

However it's still strange it detected a TOC here.

Markdown All in One consumes a lot of CPU cycles on startup with large workspaces

When opening VS Code with a workspace containing a large number of files and the Markdown All in One extension enabled, the searchService process started by VS Code consumes a lot of CPU cycles for several minutes, which unnecessarily drains battery power.

The process consuming the CPU has the following command arguments:

C:\programs\editors\vscode\Code.exe c:\programs\editors\vscode\resources\app\out\bootstrap --type=searchService

When Markdown All in One is disabled, VS Code consumes very few CPU cycles on startup. I think the source of the heavy CPU usage is the "workspaceContains" activation event:

"activationEvents": [
"onLanguage:markdown"
"workspaceContains:*.md"
]

If I remove the workspaceContains event and leave just the "onLanguage:markdown" event, the extension is very light on startup.

"activationEvents": [
"onLanguage:markdown"
]

With the "workspaceContains:*.md" activation event, the extension is so heavy on CPU, I have to disable it or modify the package.json if I want to use it.

Extension Does Nothing

Windows 10, x64.
Visual Studio Code ver 1.14.1.
Shell 1.6.6.
Renderer 56.0.2924.87.
Node 7.4.0.
Markdown All in One - Yu Zhang v0.7.5.

Computer it is running on is 7 days old and all software is freshly installed.

Installing the extension for the first time followed by a reload of VS Code, then editing a Markdown (.md) file caused VS Code to spam keyboard input hook errors on the top address bar (cannot recall exact error messages). After uninstall and reinstalling followed by another VS Code reload, the keyboard hook errors have gone away but the extension has no effect on Markdown (.md) files. It is as if the extension is disabled yet it is not.

Backspace doesn't work

Pressing the backspace key results in a warning... warn: command 'markdown.extension.onBackspaceKey' not found - and it doesn't backspace. See attached image.

image

Open Preview close the current file

Hi.

if i enable the extension Version 0.5.1, and enable preview of an markdown file, the Preview 'Tab' replaces the current file. If i am select 'Preview Side By Side' the Editor split, the Preview opens on the right side, and after one second, the Preview is the current Tab and the orginal markdown file is closed.

If i disable this Plugin, this behavior disappear.

Using vscode 1.12.0-insider 2017-04-14

PS: Previous version of this extension does not show this.

Format command treats escaped pipes as column delimiters

When using the Shift + Alt + F short cut on a table that contains escaped pipe character ( \| ) the extensions realigns them as if they were standard column delimiters ( | ). The formatter should treat these escaped pipes the same as regular characters

Auto replace text when using Unikey.

Hello there,

Your extension has some problems with Unikey.
Unikey worked well if I disabled your extension.

The bug happened when I tried to type Vietnamese with Unikey.
As I typed "Mo65t" (Unikey will convert to "Một"), the text in markdown file replaced it to Mot.

Can you show me where the function to replace the text is?

Table source beautifier

Do you plan to add automatic table code formatter / beautifier? Table code is mess sometimes and it's good to have automatic way to align.

LIke this

Setext headings should be considered in TOC

I'm running Visual Studio Code x64 1.15.1 with Markdown All in One 0.8.3. When generating a ToC for my repository's README file (linking a specific commit here for archiving purposes in case I change the header format in the future), the ToC is incomplete and only contains links to headers where I used # to mark a line as header. It looks like this:

        - [Via cloud service](#via-cloud-service)
            - [AppVeyor](#appveyor)
            - [Travis CI](#travis-ci)
            - [Docker Cloud](#docker-cloud)
        - [Locally](#locally)
            - [FDD + SCD + Chocolatey package + AppImage](#fdd-scd-chocolatey-package-appimage)
                - [Small footprint SCD](#small-footprint-scd)
            - [Docker image](#docker-image)
        - [FDD](#fdd)
        - [SCD](#scd)
        - [Docker container](#docker-container)
        - [Chocolatey package](#chocolatey-package)
        - [AppImage](#appimage)

As you can see from the original README (linked above), all h1 and h2 headers are missing.

Most Markdown flavors, including GFM and CommonMark support writing headers not only with leading # (for h1) and ## (for h2), but also with a new line consisting of any number of = (for h1) or any number of - (for h2) though. The CommonMark spec calls these "setext heading underline", see CommonMark Spec - setext heading


Example:

Sharp h1

# Sharp h1

Sharp h2

## Sharp h2

Underline h1

Underline h1
========

Underline h2

Underline h2
-------------

Is there a way to close preview while editor losting focus

When I was editing a markdown file, I need preview. But when I switch to another editor(such as a js code editor) I hope no markdown preview window appear.

So I hope when I switch to another editor, the markdown preview editr(window) can be closed automatically. If I switch back to the markdown editor, the preview window is opened to side again.

Can you implement that?

0.7.4版本在没有打开的workspace时无法工作

提交”handle activation events by hand"使得没有打开workspace时无法工作,
例如,按回车键报类似找不到对应的触发函数的错误


Translated:
v0.7.4 won't work when a single file (rather than a folder) is opened.

Add unit tests

As more and more functionalities are added, we need unit tests to make our life easier.

Table formatter bug

When I save this file it tries to turn it into a table which isn't what I want. This bug should be fixed but more importantly there should be a setting for this plugin not to change the file at all automatically. There's a setting for that but just for the TOC, not for everything.

  ## heading

  - one
    - this is `|two|`
      - three

Tools to create Tables

  • Code snippet to create basic table layout.
    |     |     |
    | --- | --- |
    |     |     |
    
    Pressing Tab should loop the cursor in different cells
  • Right clicking inside the table should have options to Add New Row At End, Add New Column At End, Add New Row(Creates new Row next to the current row), Add New Column (Creates new Column next to the current Column), Delete Row(Deletes current Row), Delete Column(Deletes current Column).

Include CSS in generated HTML file instead of referencing

If I print the current markdown into an HTML file and send it to one of my colleges, that do not have VS Code installed, the HTML looks like crap because the CSS files in there are references to files on my local machine.

        <link rel="stylesheet" type="text/css" href="file:///c%3A/Users/butzl/.vscode/extensions/yzhang.markdown-all-in-one-0.11.1/media/markdown.css">
        <link rel="stylesheet" type="text/css" href="file:///c%3A/Users/butzl/.vscode/extensions/yzhang.markdown-all-in-one-0.11.1/media/tomorrow.css">
        <link rel="stylesheet" type="text/css" href="file:///c%3A/Users/butzl/.vscode/extensions/yzhang.markdown-all-in-one-0.11.1/media/checkbox.css">

I think it would be great if the information from the file would be included into the HTML file. If this would be implemented, the HTML would also be independent from the used plugin version in VS Code.

Key value error

vs code error:
command 'markdown.extension.onEnterKey' not found
command 'markdown.extension.onTabKey' not found
command 'markdown.extension.onBackspaceKey' not found

Add markdown Shortcut element's button

Hi, was wondering if one could add more markdown expander buttons in the top right bar, right now there's a bold, italic, strikethrough, and list buttons, I'd like to add buttons for code, headings, etc, but also some not standard like for highlighting things, a button that when clicked it would add <mark>text</mark> around the selected text, is that possible? Thanks

Scroll sync should work from either MD file or Preview pane

Excellent extension and thank you for taking the time to build it! I curious if you could make the scroll sync work whether I'm scrolling over the .md file OR the preview. Scrolling syncs fine when mouse is over the preview tab, but when I want to scroll thru for edits in the .md side the preview side remains static. Maybe I have this configured incorrectly or there is a setting? Any advice is appreciated!

Backspace, Tab, and Enter don't work with "command not found" on version 0.11.1

The fix implemented in 0.11.1 to use tab/backspace to indent/outdent task lists seems to have broken the behaviour of tab, backspace and enter in normal editing mode. I.E. When not on a task list.

Pressing any of these keys throws a warning 'command markdown.extension,onbackspacekey not found',etc. and the action is not performed.

If I disable the extension and reload the editor page then the keys work as expected.

It limits the extension's usefulness. Was this really the intended behaviour of tab, backspace and entered with the extension. Thanks.

Should be inactive inside fenced code blocks

Just editing a large markdown file with a number of fenced code blocks (mine also include a language specifier) and, while editing one of those code blocks, I have noticed the extension trying to insert bullet points, and interfering with indentation when I press enter to go to a new line.

I'd suggest that the extension should try to detect if it's currently inside of a fenced code block and avoid further processing, instead deferring to normal editor behaviour until the cursor leaves the fenced code area.

Paste URL over selection to create link

The ideal UX, in my opinion, is what pasting detects URL from the clipboard and does its magic. For example, before paste:

image

After paste:

image

The next preferred method is a keyboard shortcut like here on GitHub. I select text, press a keyboard shortcut (Ctrl+K would be ideal but that one is taken by VSCode so probably Ctrl+L which is the second most popular shortcut for MD links in various editors) and get this:

image

I can then paste the URL which is in my clipboard.

Thanks for this awesome extension!


UPDATE 06/2019 for anyone reading this:

  • ✅ If clipboard contains a link, pasting over a selected text now works 🎉: #20 (comment)
  • ✅ For Ctrl+L / Cmd+L to insert links, one can define a custom snippet in keybindings.json: #20 (comment)
  • Out-of-the box keybinding provided by this extension: was blocked by microsoft/vscode#31372 but that is resolved now; I'm not sure if there are other problems but I just tried and Cmd+L is not bound by default.

Backticks in heading

This:

# `make` targets

gets converted to this broken link in table of contents:

- [`make` targets](#`make`-targets)

I believe it should be:

- [`make` targets](#make-targets)

Errors showing when VSCode opening

It seems like the last update is triggering an error whenever VSCode is opened or when I open a file.
Here are the stacktraces:

messageService.ts:125 Cannot read property 'filter' of null: TypeError: Cannot read property 'filter' of null
	at MdOutlineProvider.getChildren (/Users/Damien/.vscode/extensions/yzhang.markdown-all-in-one-0.10.1/out/src/toc.js:242:28)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:257200
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:63276
	at new n.Class.derive._oncancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:48394)
	at Object.t.asWinJsPromise (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:63239)
	at t.getTreeItems (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:257152)
	at e.$getElements (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:256203)
	at t.e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:423958)
	at e._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:280554)
	at e._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:280244)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:279271
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:281190
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:56058
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:55287)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:57078)
	at Socket. (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:102495)
e.doShow	@	messageService.ts:125
e.show	@	messageService.ts:104
(anonymous)	@	mainThreadTreeViews.ts:71
v	@	winjs.base.raw.js:1209
enter	@	winjs.base.raw.js:901
_run	@	winjs.base.raw.js:1068
_error	@	winjs.base.raw.js:1041
e.resolveErr	@	lazyPromise.ts:77
e._receiveOneMessage	@	rpcProtocol.ts:68
(anonymous)	@	rpcProtocol.ts:32
(anonymous)	@	rpcProtocol.ts:157
e.invoke	@	callbackList.ts:63
e.fire	@	event.ts:123
(anonymous)	@	ipc.net.ts:82
emitOne	@	events.js:96
emit	@	events.js:191
readableAddChunk	@	_stream_readable.js:178
Readable.push	@	_stream_readable.js:136
onread	@	net.js:560
Please return an array of children.: Error: Please return an array of children.
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:204908
    at Object.g [as _notify] (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:52522)
    at Object.enter (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:56594)
    at n.Class.derive._oncancel._run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:57915)
    at n.Class.derive._oncancel._error (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:57432)
    at e.resolveErr (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:2434911)
    at e._receiveOneMessage (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:2436272)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:2435600
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:2437519
    at e.invoke (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:66905)
e.onUnexpectedError @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:29

I know how frustrating it can be to get an error report just after a release 😅 Keep up the good work on the extension though! ❤️

format table with Chinese characters will not align to vertical line

I format one table which contains Chinese characters will appear this issue.
One Chinese character will take 2 English character space in table.
We can put 2 space for Chinese table for blank.

OSI中的层 功能 TCP/IP协议族
应用层 文件传输,电子邮件,文件服务,虚拟终端 TFTP,HTTP,SNMP,FTP,SMTP,DNS,Telnet
表示层 数据格式化,代码转换,数据加密 没有协议
会话层 解除或建立与别的接点的联系 没有协议
传输层 提供端对端的接口 TCP,UDP
网络层 为数据包选择路由 IP,ICMP,RIP,OSPF,BGP,IGMP
数据链路层 传输有地址的帧以及错误检测功能 SLIP,CSLIP,PPP,ARP,RARP,MTU
物理层 以二进制数据形式在物理媒体上传输数据 ISO2110,IEEE802,IEEE802.2

Respect indentation rules when pressing Enter

To make editing list easier, this extension overrides the Enter key behavior (by adding a Enter keyboard shortcut which will call onEnterKey).
But the Enter key behavior is not fully re-implemented (the indentation rules). Maybe I should investigate how vscode deals with the Enter key.

Table of Contents generates invalid links for dots

For example,

## Visit example.com

Will get ID of visit-examplecom by GitHub but this extension will generate a ToC link of

[Visit example.com](#visit-example-com)

I didn't do an extensive research about how all the possible ToC plugins behave but I've observer the non-dash behavior at least on GitHub, in marky-markdown and in Caret.

List editing removes marker when it's supposed to just delete extra space

For

1. list
    1. backspace before me

press backspace before b will produce

1. list
1. backspace before me

That's great. But, for

1. list
1.  backspace before me

now press backspace before b will produce

1. list
backspace before me

That isn't what it should be, user just want to delete a extra space

Engine looses track of TOC when renaming first section title of TOC

When I rename the first heading used by the TOC, the engine does not recognize the TOC anymore.

I know one of the measures to find the table is to match the first item. However, maybe one could extend this behaviour such that if the first item was not found, try to match the second.

Table formatting incorrectly handles pipes (`|`)

新建一个 Markdown 文件,输入这些内容:
Create a Markdown file and type this:

| 233 | 666 |
| --- | --- |
| `|` | 233 |

按下 Alt + Shift + F:
Press Alt + Shift + F:

| 233 | 666 |
| --- | --- |
| `   | `   | 233 |

vscode_1805

Add shortcut for strikethrough

Greetings! I'd love to have a keyboard shortcut for strikethrough (for crossing off list items)

Looking through the source code it looks like you can duplicate/modify formatting.ts

// Copy this function
function toggleBold() {
return styleByWrapping('**');
}

// Rename and change the constant to '~~'. Something like

function toggleStrikethrough() {
return styleByWrapping('~~');
}

I'd love to submit a PR, but I am not familiar with this dev environment. Seems simple enough (from my perspective), assuming binding a keystroke is also as straight forward. If you have the time, I'd love to have this. Thanks

Renumber list items

Quite a common use case for me is moving items in ordered lists. In the end, I might end up with something like:

1. Lorem ipsum
3. Dolor sit amet
2. Etc.

This obviously gets much worse in larger lists, e.g., instructions for something. It would be nice if the numbering could be fixed automatically by this extension.

toc

作者qq.com暴露了是国人, 所以直接飙中文啦

希望可以添加toc里的链接不转码的选项, 以及支持大小写,

现在如果我标题里有大写, 生成的toc是小写的

Specify the range of heading levels for TOC

I usually want to skip H1 heading from table of contents and only care about levels 2..x. For example, I'd appreciate being able to set this:

"markdown.extension.toc.levels": "2..6"

This would probably replace the current markdown.extension.toc.depth setting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.