Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ssilva opened this issue Jul 10, 2018 · 22 comments
Open

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

ssilva opened this issue Jul 10, 2018 · 22 comments
Assignees
Labels
feature-request Request for new features or functionality markdown Markdown support issues under-discussion Issue is under discussion for relevance, priority, approach
Milestone

Comments

@ssilva
Copy link

ssilva commented Jul 10, 2018

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

@vscodebot vscodebot bot added the markdown Markdown support issues label Jul 10, 2018
@stone-zeng
Copy link

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

@ghost
Copy link

ghost commented Sep 4, 2018

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.

@mjbvz mjbvz added the feature-request Request for new features or functionality label Sep 11, 2018
@odonyde
Copy link

odonyde commented Jun 6, 2019

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
Copy link

we need a custom outline view just for markdown files

@ckosmowski
Copy link

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:

private toSymbolInformation(entry: TocEntry): vscode.SymbolInformation {
return new vscode.SymbolInformation(
this.getSymbolName(entry),
vscode.SymbolKind.String,
'',
entry.location);
}
private toDocumentSymbol(entry: TocEntry) {
return new vscode.DocumentSymbol(
this.getSymbolName(entry),
'',
vscode.SymbolKind.String,
entry.location.range,
entry.location.range);
}
private getSymbolName(entry: TocEntry): string {
return '#'.repeat(entry.level) + ' ' + entry.text;
}

and then getSymbolName is also obsolete.

@pisces312
Copy link

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
Copy link

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
Copy link

Zenahr commented Jul 15, 2021

@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
Copy link

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
Copy link

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
Copy link

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

@Herman-Wu
Copy link

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
Copy link

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. :)

@mjbvz mjbvz added the under-discussion Issue is under discussion for relevance, priority, approach label Dec 6, 2022
@Acumane
Copy link

Acumane commented Dec 8, 2022

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

@zyjdmmm
Copy link

zyjdmmm commented Feb 15, 2023

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

@starball5
Copy link

starball5 commented Mar 7, 2023

@poa
Copy link

poa commented Mar 9, 2023

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

@AlbertoFabbri93
Copy link

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

@nonplayer
Copy link

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
Copy link

nonplayer commented May 9, 2024

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
Copy link

jim0203 commented Aug 15, 2024

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality markdown Markdown support issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests