weituotian / md_numbered_headers

sublime text3 plugin for markdown, auto insert/update/remove header numbers
Apache License 2.0
9 stars 1 forks source link

[Feature request] Update numbered headers for file #4

Open Kristinita opened 6 years ago

Kristinita commented 6 years ago

1. Request

It would be nice, if would be possible to create or update numbered headers for all file, not for part of the file after carriage position.

2. Justification

I never need to create or update numbered headers for part of file, I update/create headers for all file.

I want update automatically my numbered headers, if I save file. I use Sublime Hooks for it.

If:

Headers update for part of a file, not for all file.

3. Settings

For example, I have a file SashaSmartHead.md. It content:

# Sasha First

## Sasha Second|

# 1. No, Sasha First

| — is a carriage position.

4. Steps to reproduce

Ctrl+Shift+PMarkdown Numbered Headers:Insert/Update Headers Nums.

5. Actual behavior

# Sasha First

## Sasha Second

# 1. No, Sasha First

6. Expected behavior

If: Ctrl+Shift+PMarkdown Numbered Headers:Insert/Update Headers Nums For File.

# 1. Sasha First

## 1.1. Sasha Second

# 2. No, Sasha First

Thanks.

weituotian commented 6 years ago

thanks for your great advice!

may be I can provide an option to let users to select whether to update all the file content or part of the file content.

weituotian commented 6 years ago

sorry for late reply !

i had added an option format_all, you may set it to true to invoke processing all the file content. image

you may follow this guide to install the new version by commit

Kristinita commented 6 years ago

Status: :x: Still doesn't work for me

1. New data

my User/MarkdownNumberedHeaders.sublime-settings file:

{
    "dottype": ".",
    "format_all": true,
    "logging": true
}

2. Actual behavior

As in first post.

Console output:

'run insert/update---------------------'
"[[1, '1. No, Sasha First', 32, 1]]"
"[1, '1. No, Sasha First', 32, 1, '1']"
'update'
# 1. No, Sasha First
'end run--------------------'

Thanks.

biolxy commented 6 years ago
  1. When I insert an ordinal, the # in the code is also inserted a ordinal, which is obviously not what I expected:

# a test comment for my code
for(i in l){
    test <- whichSignatures(tumor.ref = sigs.input,signatures.ref = signatures.cosmic,sample.id=i,signature.cutoff=0,contexts.needed = TRUE,tri.counts.method = 'default')
    res <- test$weights  
    write.table(res,"cosmic.weight.txt",sep="\t",col.names=F,row.names=T,quote=F,append=T)
}

after of Insert/Update Headers Nums :

# 1、 a test comment for my code
for(i in l){
    test <- whichSignatures(tumor.ref = sigs.input,signatures.ref = signatures.cosmic,sample.id=i,signature.cutoff=0,contexts.needed = TRUE,tri.counts.method = 'default')
    res <- test$weights  
    write.table(res,"cosmic.weight.txt",sep="\t",col.names=F,row.names=T,quote=F,append=T)
}