8000 add newlines `<br>` or ` ` (double space) · Issue #3 · Pi-Apps-Coders/docs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

add newlines <br> or (double space) #3

Open
Itai-Nelken opened this issue Jan 7, 2022 · 2 comments
Open
< 8000 div>

add newlines <br> or (double space) #3

Itai-Nelken opened this issue Jan 7, 2022 · 2 comments

Comments

@Itai-Nelken
Copy link
Itai-Nelken commented Jan 7, 2022

some newlines are missing in the docs, for example:

something: - a - b

instead of:

something:
- a
- b

this can be fixed by adding <br> or if we don't want to use html, a double space also works but is less readable.

@Itai-Nelken Itai-Nelken changed the title add newlines <br> or add newlines <br> or (double space) Jan 7, 2022
@ryanfortner
Copy link
Collaborator
ryanfortner commented Jan 7, 2022

Thanks for noticing that! Is there any way to add <br> via a bash script, since manually going through each file isn't efficient?

@Itai-Nelken
Copy link
Author

I made a python script that reads a file and adds <br> to the end of every line if it isn't empty or starts with #:

import sys


def fix(line):
    if line.startswith('#') or line == '\n':
        return line
    return line.removesuffix('\n') + '<br>\n'

try:
    file = sys.argv[1]
except IndexError:
    print("No file provided!")
    quit(1)

out = []
with open(file, 'r') as f:
    for line in f.readlines():
        out.append(fix(line))
with open(file, 'w') as f:
    f.writelines(out)

I ran it on a test file:

# Title

Some text
- a
- b

before:
before
after:
after

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

No branches or pull requests

2 participants
0