yorkxin / copy-as-markdown

A browser extension to copy tabs and links as Markdown
MIT License
546 stars 83 forks source link

Different indent character option for tab groups #142

Closed NomarCub closed 6 months ago

NomarCub commented 6 months ago

Chrome tab groups were implemented recently: https://github.com/yorkxin/copy-as-markdown/issues/123

Now they are indented with two spaces. I'd like to be able to use tabs as an indentation character for use in some picky markdown based software (namely Obsidian). Some others might want to use more spaces instead, a custom option with input where this can be specified would be for the best I think.

This might be related to https://github.com/yorkxin/copy-as-markdown/issues/133

yorkxin commented 6 months ago

Thanks for your feedback. I'll take this feature into consideration!

yorkxin commented 6 months ago

So after studying Markdown spec, I learned that the correct way to nest an item is to put at least N spaces in front of the item, where N is number of characters before the parent item. This can be found in GFM doc (pretty much same as CommonMark.)

Examples:

- Unordered List
  - Sub Item (2 spaces+)

1. Ordered List
   2. Sub Item (3 spaces+)

100. Ordered List
     101. Sub Item (5 spaces+)

Since Copy as Markdown only outputs unorderd list, it just happen so that the nesting requires 2 spaces only.

That is not to say that all modern editors apply the same logic. For instance, Obsidian specifies that they use a tab character: Basic formatting syntax - Obsidian Help (in Nested Lists section.)

Copy as Markdown doesn't support ordered list so counting spaces isn't a problem yet. Also I guess changing the default indent style will more or less make other people unhappy, as some people prefer 2 spaces and others prefer tabs.

However I am still leaning to providing an option to support the use case of Obsidian, which prefers tab character.

yorkxin commented 6 months ago

Hi there, this feature has been implemented in 2.18.0 and is available on Chrome Web Store. Please try it out. Thank you!