pre

Preventing a <pre> from wrapping inside of a table

梦想与她 提交于 2021-02-05 07:24:05
问题 I have a table with two columns. One has some property names and the other has descriptions, including pre tags. I need the pre tags to not wrap and instead scroll to see overflow. I also need the first column to be sized based on the largest property name. I can't get the two to play nicely with each other. For example I can get the first column to size based on the content but the pre won't scroll: .main-content { max-width: 800px; border: 1px solid red; } pre { overflow: auto; } <div class

PHP Regex expression excluding <pre> tag

拥有回忆 提交于 2021-02-05 07:10:45
问题 I am using a WordPress plugin named Acronyms (https://wordpress.org/plugins/acronyms/). This plugin replaces acronyms with their description. It uses a PHP PREG_REPLACE function. The issue is that it replaces the acronyms contained in a <pre> tag, which I use to present a source code. Could you modify this expression so that it won't replace acronyms contained inside <pre> tags (not only directly, but in any moment)? Is it possible? The PHP code is: $text = preg_replace( "|(?!<[^<>]*?)(?<![?.

How can I make my background-color fill all my content, even with horizontal scrolling?

拥有回忆 提交于 2020-07-19 07:27:47
问题 I'm using an <ol> to show a code snippet with line numbers. Since I'm showing program code, I disable wrapping (and enable indentation) by setting white-space: pre on li , which means an li 's content can extend past the right margin and cause the page to have a horizontal scroll bar. So far so good. The problem comes when I want to set background colors on some of the li s to call out particular lines of code. I can set background-color on the li , but the color only extends to the right

How can I make my background-color fill all my content, even with horizontal scrolling?

拜拜、爱过 提交于 2020-07-19 07:27:06
问题 I'm using an <ol> to show a code snippet with line numbers. Since I'm showing program code, I disable wrapping (and enable indentation) by setting white-space: pre on li , which means an li 's content can extend past the right margin and cause the page to have a horizontal scroll bar. So far so good. The problem comes when I want to set background colors on some of the li s to call out particular lines of code. I can set background-color on the li , but the color only extends to the right

CKEditor escape html

不羁岁月 提交于 2020-01-24 00:40:15
问题 I have CKEditor on post text where I want to insert html-code. Something like this: <pre> <code class="html"> <img src="path/to/img.jpg" /> </code> </pre> But when I save the text, CKEditor interprets img-tag as actual html-image and shows broken image. How I can prevent that and tell to escape html-code in pre-code block 回答1: <pre> <code class="html"> <img src="path/to/img.jpg" /> </code> </pre> This is an image inside a pre element. What you want to create is: <pre> <code class="html"> <img

Rails 3.1 on Ubuntu 11.04 via RVM - uninitialized constant Psych::Syck

冷暖自知 提交于 2020-01-12 06:34:47
问题 gem install rails --pre ERROR: While executing gem ... (NameError) uninitialized constant Psych::Syck I can't seem to find any info on how to resolve this. Has anyone else had the same problem? I am using a newly created gemset in RVM with Ruby 1.9.2 回答1: I had exactly same problem on mac via RVM. Specifying version is the rescue for me. gem install rails --pre --version 3.1.0.rc1 update (2011-06-12) with rubygems 1.8.4, I can install rails 3.1.0.rc4 without specifying the version. 回答2: I had

removing spaces in <pre> tag - html

匆匆过客 提交于 2020-01-06 03:33:05
问题 Hi I am using pre tag to dispaly some text files, but the problem is at the beginning and the end, 2-3 new lines are being printed. How do I remove that? I am getting the text file through http request and I cannot modify the text file, I have to display as is. Or is there a better way to display text files in html? 回答1: I faced a similar problem in the past..... I think this could be a problem, can't tell for sure unless you share the code (I faced the problem in my AngularJS app, so the

HTML <pre> tag causes linebreaks

好久不见. 提交于 2019-12-30 01:07:11
问题 I'm using CSS (via JQuery , but not relevant to this question) to highlight certain elements within an HTML file: I'm using "pre" tags to separate out logical elements in my file, but I noticed that "pre" tags seem to leave newlines between elements. Can I get rid of these using CSS ? (Or what shall I use instead of "pre" tags? The text elements may contain HTML elements themeselves : which should not be rendered, and should be shown literally as source-code: hence my initial choice with "pre

How to preserve whitespace indentation of text enclosed in HTML <pre> tags excluding the current indentation level of the <pre> tag in the document?

陌路散爱 提交于 2019-12-28 05:16:26
问题 I'm trying to display my code on a website but I'm having problems preserving the whitespace indentation correctly. For instance given the following snippet: <html> <body> Here is my code: <pre> def some_funtion return 'Hello, World!' end </pre> <body> </html> This is displayed in the browser as: Here is my code: def some_funtion return 'Hello, World!' end When I would like it displayed as: Here is my code: def some_funtion return 'Hello, World!' end The difference is that that current

Pre increment and post increment function call

随声附和 提交于 2019-12-25 17:39:27
问题 #include<stdio.h> int main() { void add(); int i=2; add(i++,--i); print("%d",i) } void add(int a,int b) { print("%d %d",a,b); } /*what are a and b's value i am actually not getting the answer why b is 2 */ 回答1: in line 6 where add() is called first args is i++ so it will send value 2 ie value of i to the function and then add 1 now i=3. second args is --i now it will subtract 1 and iwill now be 2 again and then send value 2 to function So I think your answer will print 2 2 (that is value of a