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

Syntax highlighting #7

Open
kimmoal opened this issue Apr 24, 2018 · 2 comments
Open

Syntax highlighting #7

kimmoal opened this issue Apr 24, 2018 · 2 comments

Comments

@kimmoal
Copy link
Contributor

kimmoal commented Apr 24, 2018

In the future, please use the syntax highlighting directive in markdown:

```qml
Item {
    id: woop
}
```

or

```cpp
Item {
    id: woop
}
```
@kimmoal
Copy link
Contributor Author

kimmoal commented Apr 27, 2018

To enable a editor for the code (if we demo something qmlweb supports...):

{% include editor.html id="mousehandling" name="MouseHandling.qml" code="

import QtQuick 2.0

Rectangle {
    width: 100; height: 100
    color: 'green'

    MouseArea {
        anchors.fill: parent
        onClicked: parent.color = 'red'
    }
}

" %}

The whitespace will be trimmed from front and back.

@kimmoal
Copy link
Contributor Author

kimmoal commented May 2, 2018

Update to the editor include: the most convenient way is to use the {% capture %} directive on the code and pass it to to the editor include:

{% capture imagecode %}
import QtQuick 2.0

Image {
    width: 130; height: 100
    source: "{{ "/assets/images/qt.png" | absolute_url }}"
}

{% endcapture %}

{% include editor.html id="image-demo" name="ImageDemo.qml" code=imagecode %}

This way you don't need to escape quotes and other characters as it is basically a raw literal

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

No branches or pull requests

1 participant