microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.35k stars 28.91k forks source link

Outline view + Markdown: Do not display the "#"s #53992

Open ssilva opened 6 years ago

ssilva commented 6 years ago

The Outline view for Markdown already displays headers and sub-headers in a structured way; there is no need to pollute the view with "#"s to show the header levels.

image

stone-zeng commented 6 years ago

It would be better to use different icons (not only "[abc]") to show different header levels.

ghost commented 6 years ago

Maybe the icons could be reserved for a feature which separated different markdown components (links, tables, code blocks, etc...) but having the '#' definitely seems unnecessary.

odonyde commented 5 years ago

I support this feature request: Displaying markdown hashes in the outline view is not only redundant (the tree structure already holds this information), but also distracts from the actual content (the section title).

StefanoCecere commented 4 years ago

we need a custom outline view just for markdown files

ckosmowski commented 4 years ago

It seems like this was done totally on purpose. Since i cannot estimate the side effects besides the display in the outline i won't file a merge request. But i think we could just remove getSymbolName and replace it with entry.text in two places here:

https://github.com/microsoft/vscode/blob/28bf0b1f56dc4530331edb2e6e8bbc3df192372e/extensions/markdown-language-features/src/features/documentSymbolProvider.ts#L55-L74

and then getSymbolName is also obsolete.

pisces312 commented 3 years ago

I changed the getSymbolName function in resources\app\extensions\markdown-language-features\dist\extension.js to remove '#' char as a workaround.

getSymbolName(e){return" ".repeat(e.level)+e.text}
koffeeboi commented 3 years ago

This is what I've been using for a while.

I extended pisces312's idea with the following.

  1. Navigate to %USERPROFILE%\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\markdown-language-features\dist (Windows)
  2. Replace the getSymbolName function with the following:
    getSymbolName(e){ var symbol = { "1": "⬜", "2": "πŸŸ₯", "3": "🟧", "4": "🟨", "5": "🟩", "6": "🟦", "7": "πŸŸͺ", "8": "🟫", }; if (1 <= e.level && e.level <= 8) { return symbol[e.level] + " " + e.text; } return "#".repeat(e.level) + " " + e.text; }

Prettier version:

getSymbolName(e){
    var symbol = {
        "1": "⬜",
        "2": "πŸŸ₯",
        "3": "🟧",
        "4": "🟨",
        "5": "🟩",
        "6": "🟦",
        "7": "πŸŸͺ",
        "8": "🟫",
    };
    if (1 <= e.level && e.level <= 8) {
        return symbol[e.level] + " " + e.text;
    }
    return "#".repeat(e.level) + " " + e.text;
}

Screen shot of how it'll look like: image

Zenahr commented 3 years ago

@pisces312 answer should at least be implemented as a config option.

Here's a visual comparison showing how much more "clutter" the unnecessary #'s create:

image

image

yyangdid commented 2 years ago

I also don't like the '# with outline, and I also don't want change the native source code file with VSCode or extensions .

So, I temporarily use Emoji to better distinguish the headers level, this:

Snipaste_2021-12-11_13-58-21

And, I really want an option to hidden # 😁

vancejc-mt commented 2 years ago

Just ran across this - I wholeheartedly agree that this should be at least a setting; the hash chars don't add anything the indentation doesn't already address.

Herman-Wu commented 2 years ago

extension.js no longer has the getSymbolName function. Is there anyone who knows other way to remove the annoy "#"? @pisces312 , @koffeeboi , @ckosmowski

Herman-Wu commented 2 years ago

After some file content search, I found now we need to modify resources\app\extensions\markdown-language-features\server\dist\node\main.js instead of extension.js. And the function name changes from getSymbolName to getTocSymbolName. We can still use the original way to modify it.

pisces312 commented 1 year ago

After some file content search, I found now we need to modify resources\app\extensions\markdown-language-features\server\dist\node\main.js instead of extension.js. And the function name changes from getSymbolName to getTocSymbolName. We can still use the original way to modify it.

I just got the same issue and found you have figured out the solution. :)

Acumane commented 1 year ago

Would also be nice if we could hide syntax like **bold**. It's just more noise if not actively styling text

zyjdmmm commented 1 year ago

Have we solved this problem?It's been many years。。。

starball5 commented 1 year ago

Related question on Stack Overflow:

poa commented 1 year ago

From v1.76.0 file is: resources\app\extensions\markdown-language-features\server\dist\node\workerMain.js Function: getTocSymbolName

AlbertoFabbri93 commented 1 year ago

I agree that the hash chars add unnecessary clutter to the outline view. It would be awesome to have a setting for this

nonplayer commented 9 months ago

This is especially frustrating as a Portable Mode user. Having to go in and manually make this change every time I upgrade VSCode is a chore.

nonplayer commented 5 months ago

May 2024 and this is still an issue with VSCode 1.89.0. Seems the function has again changed names. It's no longer #getTocSymbolName(e) now it's just #se(e) - ignoring the function name, just searching the workerMain.js file for:

{return"#".repeat(e.level)+" "+e.text}

and replacing it with:

{return" ".repeat(e.level)+e.text}

still applies the fix.

jim0203 commented 1 month ago

I'm using 1.92.1 on macOS. What would be the path and file that is equivalent to resources\app\extensions\markdown-language-features\server\dist\node\workerMain.js?

I've found this path:

/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist

Which contains a serverWorkerMain.js file. That file includes the text that @nonplayer says should be replaced, but replacing it doesn't fix the issue.

Do I need to do something else (beyond restarting VSCode) to get the change to register? Or am I editing the wrong file?

nonplayer commented 1 month ago

I'm using 1.92.1 on macOS. What would be the path and file that is equivalent to resources\app\extensions\markdown-language-features\server\dist\node\workerMain.js?

I've found this path:

/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/markdown-language-features/dist

Which contains a serverWorkerMain.js file. That file includes the text that @nonplayer says should be replaced, but replacing it doesn't fix the issue.

Do I need to do something else (beyond restarting VSCode) to get the change to register? Or am I editing the wrong file?

Coincidentally, I just today updated and just now came here to post that the file had again changed location to: .\resources\app\extensions\markdown-language-features\distserverWorkerMain.js

However I didn't encounter the same trouble you are reporting. I was able to do a find and replace, finding the same string as previous:

{return"#".repeat(e.level)+" "+e.text}

and replacing it with:

{return" ".repeat(e.level)+e.text}

Saving and re-opening VSCode applied the fix for me as expected. However, I'm on Windows, maybe that makes a difference somehow?

I'm quite befuddled as to why they have not fixed this obvious bug yet.