Modify

Opened 3 years ago

Closed 3 years ago

#14027 closed enhancement (fixed)

Use ''Code fences'' syntax for WikiProcessors

Reported by: Cinc-th Owned by: Cinc-th
Priority: normal Component: MarkdownMacro
Severity: normal Keywords:
Cc: Trac Release: 1.4

Description

WikiProcessors are supported with Trac syntax:

{{{#!python
Foo = 1
}}}

This breaks compatibility with other Markdown editors when exported. The processor will be printed in other editors like this:

{{{#!python Foo = 1 }}}

Code fences are supported by the macro but the rendering is not nice and no syntax highlighting is currently enabled.

By replacing Trac syntax any WikiProcessor will be rendered properly as a code block when editing Markdown text in another editor.

Changes

To aim for better compatibility with other tools the following should be implemented.

  1. Support Code fences with language specifiers:
    ```python
    # Python code here...
    ```
    
  2. Use code fence syntax for Trac WikiProcessors:
    ```diff
    --- Version 55
    +++ Version 56
    @@ -115,8 +115,9 @@
         name='TracHelloWorld', version='1.0',
         packages=find_packages(exclude=['*.tests*']),
    -    entry_points = """
    -        [trac.plugins]
    -        helloworld = myplugs.helloworld
    -    """,
    +    entry_points = {
    +        'trac.plugins': [
    +            'helloworld = myplugs.helloworld',
    +        ],
    +    },
     )
    ```
    
    instead of:
    {{{#!diff
    ...
    }}}
    

This can easily be achieved in a preprocessor extension by replacing code fences with Trac syntax which is subsequently interpreted by the wiki processor extension already implemented.

Another way is by directly replacing the code fence extension with one using Trac as the rendering backend.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by Cinc-th

Resolution: fixed
Status: assignedclosed

In 18332:

MarkdownMacro: allow code fence syntax for WikiProcessors. Moved all WikiProcessors related code into one source file.

Closes #14027

comment:2 Changed 3 years ago by Cinc-th

Resolution: fixed
Status: closedreopened

Code fences without any language specification no longer work.

```
Some text
```

is rendered as

{{#! Some text }}} 

comment:3 Changed 3 years ago by Cinc-th

Resolution: fixed
Status: reopenedclosed

In 18333:

MarkdownMacro: fix code fence for cases where no language specifier was given.

Closes #14027

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Cinc-th.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.