Trying to keep whitespace in a code block - whitespace

I'm trying to use markdown to format a web page. Part of the web page has block quotes and code blocks. In some of the code blocks, the leading and trailing white space (empty lines) is important. I can't find much on this and can't figure out how to include the leading and trailing empty lines.
> empty_line
> empty_line
> Stuff Here
> empty_line
> empty_line
.. if that makes any sense.

If you can use HTML tags, have you tried using the pre tags?
Stuff 1 here
Stuff 2 here
I use pre at very top with HTML tag brackets of course and closed that tag at the bottom. Using this tag retains the blank lines + creates a code block as you see.

Related

Blank as last character in a monospace formatted text

Writing a documentation, I have some small text examples to give, which should be formatted as monospace text by using backticks. Theses text snippes contains always as last character a blank, which must not be omitted, as it is significant. Unfortunately Asciidoctor omits them.
For example `: ` should be rendered as : . But instead it is readered as :.
So how does the markup look to get a colon and a blank rendered as preformatted?
There's the built-in attribute {nbsp} for non-breaking space in Asciidoctor, which can be used for a blank.
So `:{nbsp}` is rendered as : .

Why does Sphinx+MyST put spaces inside HTML tags in the generated output?

I'm new to MyST and Sphinx, so perhaps this has an obvious explanation, but it is not obvious to me. Whenever I use any construct in my Markdown source, such as bold facing or italics or even an html element such as <span>, the result in the formatted HTML output contains spaces inside the HTML tags. For example, an input such as
* **Barcode**: the barcode identifying the item
* **Title**: the title of the item.
* **Author**: the author of the item.
produces this:
Note the space before the :. Inspecting the HTML reveals that the bold-faced element contains unexpected space characters:
Note the spaces inside the <strong>...</strong>. Why is this happening? What am I doing wrong? More importantly, how do I make it stop?
I'm using Sphinx 3.4.3 with myst-parser 0.13.3. My conf.py defines extensions as 'myst_parser', 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', and 'sphinx.ext.napoleon'.

Ruby/Regex: Dealing with strings containing forward slashes and parentheses using gsub and regex

Hi I am using Watir to click through some links. I go to a page, click a link based on its text, and the do it again click a new link. I am locating the links based on their text (it is the only way I can based on their HTML) and need to match the text I pulled from the page to the link. The text that I get contains some extra text not part of the link, so I need to gsub it out. Here is my issue:
String: text = "Nuclear Launch Codes (Levels One/Two)"
Link: Nuclear Launch Codes (Levels One/Two) Blah Blah Blah
Because the links do not always have the exact text I need to locate them like so: /#{text}/
Problem is that returns "Nuclear Launch Codes (Levels One\/Two)"
I though I would gsub the 1st parenthesis and everything after, but I need to keep it because I can have Nuclear Launch Codes (Levels Four/Five)
Is there anyway to modify the string to match the link while ignoring the rest of the link text?
If I understand you correctly, try:
/#{Regexp.escape(text)}/
Or equivalently, if you prefer:
Regexp.new(Regexp.escape(text))
This will automatically escape parentheses, slashes and so on in the text so they are not treated as special regexp characters.

In ckeditor how can we avoid extra non-breaking spaces in paragraph tags?

When editing in ckeditor I very frequently end up with extra clusters of <p> </p> tags. Not only does it add extra unneeded linebreaks, they often show up on the resulting page with a broken-looking character in them.
Is there a configuration setting or something to tell the editor not to add these extra non-breaking spaces in paragraph tags?
Thanks,
doug
The paragraphs with represent empty lines in editor. They make the content look exactly the same inside editor and outside it (when displayed on a target page). If they cause you some problem, then it's not the editor, but your backend. So I rather recommend checking it.
Surprisingly though, there's an option to disable filling empty blocks config.fillEmptyBlocks.
But it's really not the answer.

separating a multi-page ascii file

I have a multi-page ascii file, and I need to be able to separate this file into single page ascii files.
At the end of each page should be a page break inserted. My original thoughts are to read up to a page break, output to file, but then how would I make it read to a page break and then continue to start over reading from that page break to the next? Or is there another, easier way of doing this?
csplit allows you to split a file by regex.

Resources