Giter Site home page Giter Site logo

Syntax highlighting about ponzu HOT 14 CLOSED

ponzu-cms avatar ponzu-cms commented on May 1, 2024
Syntax highlighting

from ponzu.

Comments (14)

Riari avatar Riari commented on May 1, 2024 2

That would be fine, actually :) I have no issue rendering client-side.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024 2

@Riari Hey - sorry for the long delay, I have had a bunch of "day job" work eating up most of my time... I found someone had made a markdown editor input for Ponzu.. maybe this would work for you?

https://github.com/aleksen/smdeditor cc: @aleksen

since there is no license, you should be careful what you're using it for.. maybe the author will consider adding one (I suggest BSD like ponzu or MIT if you like it better)

from ponzu.

aleksen avatar aleksen commented on May 1, 2024 1

Hi! I haven't put a licence in there yet, but it will be BSD. Feel free to fork or create PRs for the plugin.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

Hi @Riari -

Thank you for the kind words. I'm glad you think so!

Just to clarify.. you are using a editor.Richtext() in your content type's MarshalEditor() to create the editor within the CMS. When you type <pre><code>...</code></pre> inside the richtext editor, those pre/code blocks are deleted from your input entirely?

Assuming the above is accurate, are the pre/code blocks stripped out after you hit 'Save'? Or, are you writing your pre/code blocks inside the "code view" (the <> icon in the richtext editor) or in the "standard view"?

Is the content inside the pre/code block stripped as well, or only the pre/code HTML tags?

Steve

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

Beyond changing the field to a plain textarea for now, any other suggestions? Could this be considered for a potential feature?

I think if we don't find a solution to your issue, adding a editor.Code() func that simplifies writing formatted and syntax highlighted code would be a great feature to consider.

from ponzu.

Riari avatar Riari commented on May 1, 2024

I was entering the pre/code markup in the code view and hitting Save immediately after that. After testing further, it appears that anything you enter in that view gets lost on save unless you switch back to the preview first (I guess the editor doesn't commit changes to the textarea until that point). So that's another issue altogether.

While that does mean it's possible to use the markup with editor.Richtext(), it presents another issue: when you change back to the preview, the markup is automatically formatted and that's problematic for pre elements since there's extra whitespace resulting from the indentation.

Having a editor.Code() sounds good, but I don't know how suitable it would be for my particular use case (basically blog posts with code samples featured throughout).

Hope that helps :) I'm somewhat new to Go myself, otherwise I'd offer to explore a potential PR for this.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

@Riari - would a markdown editor with syntax highlighting work, i.e. https://jbt.github.io/markdown-editor ?

from ponzu.

Riari avatar Riari commented on May 1, 2024

Yeah, something like that would be ideal actually.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

Yea, I think it could be a nice addition too. Would you prefer the un-rendered markdown, or rendered html in the json api responses?

from ponzu.

Riari avatar Riari commented on May 1, 2024

Having the HTML returned would suit me, but having the option to control it might be nice - maybe through an option in the admin config, or a checkbox below the editor in the form, or a querystring param like ?renderMarkdown=1.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

Ok, thanks for the feedback. Would it be a significant issue if we were to only return the raw markdown? or would client-side markdown parsing be something you can live with?

from ponzu.

Riari avatar Riari commented on May 1, 2024

Thanks for the heads up; I'll take a look. If nothing else, at least it'll give me an idea of how to tackle it.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

@aleksen - I may need it for a upcoming project and if I do, I'd be happy to contribute to your repo.

from ponzu.

olliephillips avatar olliephillips commented on May 1, 2024

Closing this issue. It's been a while since there has been any activity. Please reopen if need to.

from ponzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.