import panel as pn import param pn.extension('ace') py_code = """import sys""" editor = pn.widgets.Ace(value=py_code, sizing_mode='stretch_both', language='python', height=300) editor editor.value += """ import Math x = Math.cos(x)**2 + Math.cos(y)**2 """ html_code = r""" `substitute(Filename('', 'Page Title'), '^.', '\u&', '')`

Title1

Title2

Paragraph

""" editor.language = "html" editor.theme = "monokai" editor.value = html_code editor.annotations= [dict(row=1, column=0, text='an error', type='error'), dict(row=2, column=0, text='a warning', type='warning')] #editor.readonly = True editor.filename = 'test.html' class AceTest(param.Parameterized): editor = param.String('Hello World') def view(self): """ Map the string to appear as an Ace editor. """ return pn.Param( self.param, widgets=dict( editor=dict( type=pn.widgets.Ace, language='python', ) ) ) ace = AceTest() ace.view() widget = pn.widgets.Ace(name='Ace', value=py_code, sizing_mode='stretch_both', height=300) pn.Row(widget.controls(jslink=True), widget)