Skip to content

[FR] Omit HTML tags in text previews #251

@greetclammy

Description

@greetclammy

Describe the feature

Omit the pattern <tag></tag> from text previews.

Could be done behind the scenes or added as an option.

First Line is Title performs this successfully. Here's its code:

    // Remove HTML tags (all tags with opening and closing pairs) - handle nested tags
    if (settings.omitHtmlTags) {
        let previousLine = '';
        while (line !== previousLine) {
            previousLine = line;
            line = line.replace(/<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>(.*?)<\/\1>/g, '$2');
        }
    }

Why would this be useful?

I often rely on HTML tags like <u> or <center> in notes because the markdown spec doesn't support underline and align center. This results in unsightly HTML tags previews being shown by the plugin.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions