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

Highlighting the beginning and end .twig #621

Open
jonyb01 opened this issue Sep 19, 2023 · 8 comments
Open

Highlighting the beginning and end .twig #621

jonyb01 opened this issue Sep 19, 2023 · 8 comments
Labels
S: triage Issue needs triage.

Comments

@jonyb01
Copy link

jonyb01 commented Sep 19, 2023

Hi, I have a problem that I can't solve due to the fact that I don't know how to defeat it, I use BracketHighlighter in Sublime text 4154, and I can't figure out how to make the BracketHighlighter plugin highlight the beginning and end in the template.twig, please tell me how to fix it.

Screenshot:https://prnt.sc/bbNKsyB8k0Xc

@gir-bot gir-bot added the S: triage Issue needs triage. label Sep 19, 2023
@facelessuser
Copy link
Owner

You likely need to create a new rule, maybe even a BH plugin, but I don't know as I don't use Twig. You would have to provide some copy/pastable example and point me at the actual syntax file you use to highlight Twig. When I have some time, I may be able to give you some pointers to lead you in the right direction.

@jonyb01
Copy link
Author

jonyb01 commented Sep 19, 2023

Вероятно, вам потребуется создать новое правило, возможно, даже плагин BH, но я не знаю, поскольку не использую Twig. Вам нужно будет предоставить пример копирования/вставки и указать мне фактический файл синтаксиса, который вы используете для выделения Twig. Когда у меня будет немного времени, я, возможно, смогу дать вам несколько советов, которые поведут вас в правильном направлении.

Thanks a lot for the answer, I provide data from the weaving settings of your plugin

Bracket Setting

{
    "content_highlight_bar": true,
    "search_in_widgets": true,
    "match_only_adjacent": true,
    "high_visibility_color": "__bracket__",
    "auto_selection_threshold": 10,
}

Tag Setting

{
"tag_mode": [
        {"mode": "xml", "syntax": ["XML"]},
        {
            "mode": "xhtml",
            "syntax": [
                "HTML",
                "HTML 5",
                "PHP",
                "HTML (Jinja Templates)",
                "HTML (Jinja2)",
                "HTML (Rails)",
                "HTML (Twig)",
                "HTML (Django)",
                "laravel-blade",
                "blade",
                "Handlebars",
                "AngularJS",
                "Java Server Pages (JSP)"
            ],
            "first_line": "^[ \\t]*<\\?xml"
        },
        {
            "mode": "html",
            "syntax": [
                "HTML",
                "HTML 5",
                "PHP",
                "HTML (Jinja Templates)",
                "HTML (Jinja2)",
                "HTML (Rails)",
                "HTML (Twig)",
                "HTML (Django)",
                "laravel-blade",
                "blade",
                "Handlebars",
                "AngularJS",
                "Java Server Pages (JSP)"
            ]
        },
        {
            "mode": "cfml",
            "syntax": ["CFML", "HTML+CFML", "ColdFusion", "ColdFusionCFC"]
        }
    ],
"user_brackets": [
        // Angle
        {
            "name": "angle",
            "language_list": [
                "HTML", "HTML 5", "XML", "PHP", "HTML (Rails)",
                "HTML (Jinja Templates)", "HTML (Jinja2)", "HTML (Twig)",
                "CFML", "HTML+CFML", "ColdFusion", "ColdFusionCFC",
                "laravel-blade", "Handlebars", "AngularJS",
                "SomeNewLanguage" // <--- New language
            ]
        }
    ],

    "tag_style": {
        "xml": "tag",
        "xhtml": "tag",
        "html": "tag",
        "cfml": "tag"
    },

"start_tag": {
        "xml": "<(%(tag_name)s)(?:(?:\\s+|(?<=['\"]))%(attributes)s)*\\s*(/?)>",
        "xhtml": "<(%(tag_name)s)(?:(?:\\s+|(?<=['\"]))%(attributes)s)*\\s*(/?)>",
        "html": "<(%(tag_name)s)(?:(?:\\s+|(?<=['\"]))%(attributes)s)*\\s*(/?)>",
        "cfml": "<(%(tag_name)s)(?:(?:(?:\\s+|(?<=['\"]))%(attributes)s)*|(?:(?<=cfif)|(?<=cfelseif))[^>]+)\\s*(/?)>"
    },

    // Regex for end/closing tag.  Only use a capturing group for name.
    "end_tag": {
        "xml": "</([\\w\\:\\.\\-]+)[^>]*>",
        "xhtml": "</([\\w\\:\\.\\-]+)[^>]*>",
        "html": "</([\\w\\:\\.\\-]+)[^>]*>",
        "cfml": "</([\\w\\:\\.\\-]+)[^>]*>"
    }
}

Sublime Setting

{
    "theme": "Default Dark.sublime-theme",
    "ignored_packages":
    [
        "Vintage",
    ],
    "color_scheme": "Packages/Color Scheme - Legacy/Monokai Bright.tmTheme",
    "open_files_in_new_window": "false",
    "font_size": 13,
    "tab_size": 2,
    "word_wrap": "true",

}

HTML (twig) syntax specific

{
  "show_line_endings": true,
}


{
  "show_line_endings": true,
}

If I didn't provide the data you need, I'm sorry.

@facelessuser
Copy link
Owner

Are you using a 3rd party twig package for syntax highlighting or are you using a built-in syntax? Please specify exactly what you are using to syntax highlight Twig.

Also, provide me some copy/pastable Twig code as I am not familiar with Twig and do not want to hunt down an example online.

@jonyb01
Copy link
Author

jonyb01 commented Sep 19, 2023

Используете ли вы сторонний пакет twig для подсветки синтаксиса или используете встроенный синтаксис? Пожалуйста, укажите, что именно вы используете для подсветки синтаксиса Twig.

Кроме того, предоставьте мне код Twig для копирования и вставки, поскольку я не знаком с Twig и не хочу искать пример в Интернете.

1.I use BetterTwig for highlighting.
2.Excuse me, but I don't understand this --> "give me the Twig code to copy and paste" where can I see it ? ))

@facelessuser
Copy link
Owner

Provide an example Twig snippet that I can use for testing that doesn't require me to transcribe it from a screenshot. I don't write Twig, so you need to provide me with an example snippet.

@jonyb01
Copy link
Author

jonyb01 commented Sep 19, 2023

Предоставьте пример фрагмента Twig, который я могу использовать для тестирования, и который не требует от меня расшифровки его со снимка экрана. Я не пишу Twig, поэтому вам нужно предоставить мне пример фрагмента.

here is the twig code for an example

<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<ul id="navigation">
{% for item %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>
<ul id="navigation2">
{% if item %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endif %}
</ul>
<h1>st</h1>
{{ a_variable }}
</body>
</html>

@facelessuser
Copy link
Owner

Okay, when I have some time, I'll take a look.

@jonyb01
Copy link
Author

jonyb01 commented Sep 19, 2023

Хорошо, когда будет время, я посмотрю.

Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: triage Issue needs triage.
Projects
None yet
Development

No branches or pull requests

3 participants