We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24074
    • 81 Posts
    Hi, I’d like to know if it’s possible to change out MODx code formatting from this:

    http://mysticpaste.com/view/2837

    to this:

    http://mysticpaste.com/view/2838

    I like to have clean and readable code and its quite crucial to me.

    Thanks
      Radio sucks!
      • 7914
      • 137 Posts
      The editor will compress your code for you. To clean it up a little more, I would use <p> tags instead of all the
      ’s. You could use css to modify the line-height or margin/padding to give you the same look as doubling up
      tags.
        • 20413
        • 2,877 Posts
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 24074
          • 81 Posts
          hmm, i don’t have nothing against
          ’s, i prefer them over having 5 paragraphs.
          Also, i tried @mrhaw’s plugin but it didn’t worked for me as expected, code is still not readable.
          Note that I haven’t mentioned indenting, you probably got such impression from how pastebin formatted the code.

          What i want is that text be wrapped by paragraph with <p> above and </p> bellow it and also
          ’s to be on new line one beneath another, just like in this example:

          <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pharetra odio in dolor porttitor id lacinia dui pretium. Vivamus non eros a mauris fermentum feugiat. Etiam odio nisi, pellentesque a laoreet nec, rutrum quis quam. Duis eu ligula eros. In sed quam quis justo tristique aliquam at ut mauris. Etiam eu ipsum in sem tempor suscipit eget eget enim. Etiam ante metus, convallis nec lobortis sit amet, consequat non urna. Nulla elit neque, molestie sit amet ornare in, consectetur id augue. Praesent vitae sagittis massa. Vivamus tortor elit, consequat quis pretium nec, ultricies vitae tortor. Curabitur ullamcorper adipiscing felis, quis cursus dui ornare in. Aliquam erat volutpat. Curabitur et nunc augue. Nulla purus nibh, placerat sit amet adipiscing eget, semper a nisi. Maecenas in dapibus magna. Integer pulvinar aliquet enim non interdum. Vestibulum auctor sodales dictum.




          Maecenas quis mauris leo. Sed eleifend libero dolor. Mauris vitae nisl magna. Nullam eu velit imperdiet urna rhoncus auctor at quis purus. Quisque sodales sagittis orci venenatis suscipit. Suspendisse tellus turpis, egestas ac rutrum in, suscipit ultrices libero. Nullam feugiat, turpis et laoreet tincidunt, ipsum est ultrices purus, sed elementum dolor quam non arcu. Pellentesque erat purus, rhoncus eget tempor sed, ullamcorper at velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed blandit, nisi et venenatis tempor, sapien metus pellentesque tortor, sit amet mattis turpis sapien in dui.




          Sed eleifend consequat dolor non congue. Vestibulum et felis quis neque vulputate iaculis ac ut tellus. Nullam euismod pulvinar blandit. Suspendisse potenti. Proin sollicitudin, nunc in facilisis convallis, sapien lacus porta dui, eu dignissim lacus neque eget neque. Vivamus turpis enim, egestas quis rutrum sed, suscipit in mi. Aliquam venenatis rhoncus tortor id gravida. Vestibulum molestie eleifend quam, et faucibus risus sodales quis. Suspendisse potenti. Vestibulum at orci eget diam pharetra dapibus sed ut metus. Fusce pretium lectus eu nisl venenatis cursus. Pellentesque pretium, dui vel pulvinar convallis, diam sem bibendum magna, sit amet lacinia nulla lectus eu quam.
          </p>

          is that somehow possible?
          maybe i ask too much but i come from hand-coding environment where i had all possible control over the markup so this appears strange and chaotic to me wink

          Thanks.
            Radio sucks!
            • 27708 MODX Staff
            • 2,502 Posts
            @purpler,

            I am not sure what the advantage of using
            elements is. The text is a set of paragraphs and therefore logical to use a paragraph element to make them. It seems that you are trying to solve a design problem through markup. I am not a standards-maniac and understand reasonable compromise in markup for both clients and developers. If the ultimate goal for you is to have 2 line spaces between your paragraphs on the front end that you create a paragraph declaration in your CSS like so:

            #mycontent p {
                margin-bottom:24px; //where 24px might be 2 times the height of your paragraph font. 
                }
            


            This is what your code would look like and it contains the exact same number of element tags and it works with the default implementation of TinyMCE.
            <p>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pharetra odio in dolor porttitor id lacinia dui pretium. Vivamus non eros a mauris fermentum feugiat. Etiam odio nisi, pellentesque a laoreet nec, rutrum quis quam. Duis eu ligula eros. In sed quam quis justo tristique aliquam at ut mauris. Etiam eu ipsum in sem tempor suscipit eget eget enim. Etiam ante metus, convallis nec lobortis sit amet, consequat non urna. Nulla elit neque, molestie sit amet ornare in, consectetur id augue. Praesent vitae sagittis massa. Vivamus tortor elit, consequat quis pretium nec, ultricies vitae tortor. Curabitur ullamcorper adipiscing felis, quis cursus dui ornare in. Aliquam erat volutpat. Curabitur et nunc augue. Nulla purus nibh, placerat sit amet adipiscing eget, semper a nisi. Maecenas in dapibus magna. Integer pulvinar aliquet enim non interdum. Vestibulum auctor sodales dictum.
            </p>
            <p>
                Maecenas quis mauris leo. Sed eleifend libero dolor. Mauris vitae nisl magna. Nullam eu velit imperdiet urna rhoncus auctor at quis purus. Quisque sodales sagittis orci venenatis suscipit. Suspendisse tellus turpis, egestas ac rutrum in, suscipit ultrices libero. Nullam feugiat, turpis et laoreet tincidunt, ipsum est ultrices purus, sed elementum dolor quam non arcu. Pellentesque erat purus, rhoncus eget tempor sed, ullamcorper at velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed blandit, nisi et venenatis tempor, sapien metus pellentesque tortor, sit amet mattis turpis sapien in dui.
            </p>
            <p>
                Sed eleifend consequat dolor non congue. Vestibulum et felis quis neque vulputate iaculis ac ut tellus. Nullam euismod pulvinar blandit. Suspendisse potenti. Proin sollicitudin, nunc in facilisis convallis, sapien lacus porta dui, eu dignissim lacus neque eget neque. Vivamus turpis enim, egestas quis rutrum sed, suscipit in mi. Aliquam venenatis rhoncus tortor id gravida. Vestibulum molestie eleifend quam, et faucibus risus sodales quis. Suspendisse potenti. Vestibulum at orci eget diam pharetra dapibus sed ut metus. Fusce pretium lectus eu nisl venenatis cursus. Pellentesque pretium, dui vel pulvinar convallis, diam sem bibendum magna, sit amet lacinia nulla lectus eu quam.
            </p>
            
            


            To me this is no more or less readable than your line breaks version. It is semantic (as a byproduct).

            If you really want to make it do what you want with the breaks you can look at modifying the behaviour of Tiny http://wiki.moxiecode.com/index.php/TinyMCE:Index.

            You mentioned to me on twitter that you don’t want to have TIny override your styles. Is it that you want to hand code whatever you want into hte content area and not have the client edit it? If so you can use permissions to do that and. In addition you can turn off Tiny for your user and leave it on for your client.

              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 24074
              • 81 Posts
              Hi, thanks for reply, I appreciate it.

              Umm, I don’t need frontend content to be separated by bottom margin, what i want to achieve is that when somebody opens page source it needs to be formatted exactly the way i wrote it.

              There is no really good explanation for that demand except strictly being aesthetic, its just that i like to have full control over tool i use and code being generated by it.

              Also, awesome tip about letting users edit with TinyMCE while letting designer to edit via HTML directly but that also don’t solve my "problem". When client edits the content, TinyMCE is still going to format entire editable area HTML by its guidelines.

              I need a way to tell to TinyMCE to wrap content between upper opening and bottom paragraph closing tags and to separate each paragraph with newline + 2x
              + newline, exactly as i posted previously.

              is that possible or am I talking rubbish? smiley

              Thanks once again!
                Radio sucks!
                • 25663 MODX Staff
                • 12,272 Posts
                I don’t think you’ll ever see support for that from TinyMCE or any other RTE for that matter. You’d have better luck inquiring about that in those communities. (Tiny, CK, etc.)
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Actually, you can do this using the "custom parameters" field in the TinyMCE configuration. Study the configuration documentation at the Moxiecode wiki. Lots of interesting things you can make it do.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 27347
                    • 65 Posts
                    There used to be a time when i was really hung up on my html source code. Everything needed to be exactly as i wanted with proper indenting, open/close tags etc. But i stopped, it’s a waste of time. I just make sure my templates are neat and everything else outputted by an rte i don’t really care how it looks.
                      • 3749
                      • 24,544 Posts
                      Quote from: SiNNuT at Jul 29, 2010, 10:20 AM

                      There used to be a time when i was really hung up on my html source code. Everything needed to be exactly as i wanted with proper indenting, open/close tags etc. But i stopped, it’s a waste of time. I just make sure my templates are neat and everything else outputted by an rte i don’t really care how it looks.

                      Same here. If people want to steal my ideas, they should at least have to put in a little effort. wink wink wink
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting