简体   繁体   English

Javascript HAML编辑器

[英]Javascript HAML editor

Does anyone know of a Javascript based HAML editor out there? 有没有人知道基于Javascript的HAML编辑器? I'm looking for for something like TinyMCE that just understands HAML (so it does indenting and highlighting correctly) 我正在寻找像TinyMCE这样只能理解HAML的东西(所以它确实缩进和突出显示)

I'm thinking of using an editor like this for a dynamic website I'm building. 我正在考虑使用这样的编辑器来构建我正在构建的动态网站。

Clarification The site I am building allows the users to define layouts(in the rails sense) and css. 澄清我正在构建的站点允许用户定义布局(在rails意义上)和css。 So finer grain control than textile and markdown is required, I know I can include raw html in markdown but haml is so much prettier. 因此需要比纺织品和降价更精细的谷物控制,我知道我可以在降价中包含原始html但是haml是如此漂亮。

HAML was designed as a more elegant way to define page structure; HAML被设计为一种更优雅的方式来定义页面结构; It was not intended to be used for formatting text, like what you're asking it to do. 它不是用于格式化文本,就像你要求它做的那样。

In this case, you're probably better off using something like Markdown or Textile . 在这种情况下,你可能最好使用MarkdownTextile之类的东西。 Both of these already have WYSIWYGs ( for Markdown , for Textile ( forked version )), and Haml's got built-in filters to convert it into HTML. 这两者都已经具有WYSIWYG( 用于Markdown用于Textile分叉版 )),而Haml有内置的过滤器将其转换为HTML。

eg: 例如:

#content
  :markdown
    @post.body

(Haml's wonderful space-indentation will even be preserved on output!) (Haml的精彩空间缩进甚至会在输出中保留!)

I noticed this question hasn't been answered in a while. 我注意到这个问题暂时没有得到解答。 While this isn't a complete answer, you may want to look at MarkItUp . 虽然这不是一个完整的答案,但您可能需要查看MarkItUp Its specifically not a WYSIWYG editor, but rather, an extensible and friendly markup editor. 它特别不是 WYSIWYG编辑器,而是一个可扩展且友好的标记编辑器。 It doesn't support HAML directly, but its fairly easy to extend it to support different languages. 它不直接支持HAML,但它很容易扩展它以支持不同的语言。 It can also do AJAX round trips to the server so you can preview the markup using a server side renderer. 它还可以执行到服务器的AJAX往返,因此您可以使用服务器端渲染器预览标记。

I have something pretty basic up and running for interpreting javascript HAML code . 我有一些非常基本的东西用于解释javascript HAML代码 Alternatively, you can go direct to the jHaml javascript source . 或者,您可以直接转到jHaml javascript源代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM