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

for setext style headers the underline is displayed in the symbol list #158

Closed
e3krisztian opened this issue Feb 28, 2014 · 8 comments
Closed

Comments

@e3krisztian
Copy link

Setext headers like this
------------------------

show up as underlines (------------------------) instead of the header text in symbol view (ctrl-p @ or ctrl-r)

ST 2.0.2 (Linux), MarkdownEditing 2.0.6

@maliayas
Copy link
Member

I am aware of that. Unfortunately, capturing the header text for setext headers is not possible afaik. For this reason, instead of showing nothing, I preferred displaying the underlines to indicate there is a header there.

@maliayas
Copy link
Member

But maybe we can put a fixed placeholder text instead of ----- and ====. What do you think?

@e3krisztian
Copy link
Author

Well, I do not think it would help much placing a message instead of the underlines in the symbol list.

I have looked into it a bit and even had partial success: had multi-line paragraphs show up as one line in the symbol list (modified Markdown.tmLanguage at meta.paragraph.markdown's patterns), tailor it down for the first line in a special case (with a new symbolTransformation in Symbol List - Heading.tmPreferences).
However I could not filter the paragraphs down to headers - either all paragraphs or none was shown.

So I feel it should be possible, but too hard for me to make it.

@maliayas
Copy link
Member

maliayas commented Mar 1, 2014

It is not possible.

For multiline blocks, Sublime Text offers only one way for capturing. It is this: you define a regex to capture the beginning and another regex to capture the end of the block. This way you can define the block. However, those regexes can be run against only a single line.

To put it in another way, if you can define the beginning and the end regex for a setext header, I can help you with the rest.

The second regex is easy: ^[=\-]+$

But the first one is not. If you think something like this: ^.+(?=\n[=\-]+$) it won't work because it is not allowed to overflow to the next line.

@e3krisztian
Copy link
Author

OK, I see now, thanks!

At the time of trying I was unable to find any usable Sublime Text documentation on it, certainly not something with details you mentioned.

Is TextMate's 12.2 Language Rules the ST documentation?


I see any of these steps slightly forward:

  • notify Jon about the problem, so that ST could develop this feature in the future

  • document it in the README.md with text like

    ## KNOWN BUGS ##
    
    - Setext headers do not show up in symbol list (#158)
    
  • show some strange looking placeholder instead of underlines as you first mentioned - (Setext header - MarkdownEditing #158: can not show it here, sorry)

But these are just slightly better than simply closing this issue, so closing is fine as well.

@maliayas
Copy link
Member

maliayas commented Mar 3, 2014

Is TextMate's 12.2 Language Rules the ST documentation?

That mostly applies to ST, too. However, I couldn't find the detail I mentioned (single-line only regex) there. When the docs doesn't cover things, trial and error is your friend. And don't forget to read the unofficial docs.

show some strange looking placeholder instead of underlines as you first mentioned

Underlines are better IMHO.

document it in the README.md with text like

Done.

@maliayas maliayas closed this as completed Mar 3, 2014
@e3krisztian
Copy link
Author

Thank you for explaining all the details and your time!

:)

(BTW the README.md have not changed, yet)

@maliayas
Copy link
Member

maliayas commented Mar 4, 2014

Haha, you're creative with markdown :)

It's in the v2.0.7 branch. Not merged yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants