Markdown Paragraph - formatting

I'm encountering a problem in Markdown paragraph.
I use Notepad in Microsoft Windows to create .md file and use Typora for rendering.
The new lines in the same paragraph are treated as new line in rendering.
For example, if my .md file contains the following text
Electric Field inside
a conductor
is zero
The Typora renders as it is with new lines....whereas it is expected the rendering should be like this
Electric Field inside a conductor is zero.
i.e new lines inside the same paragraph to be formatted in proper paragraph sense and not like code listing. Whats the mistake I' doing ?.

Typora seems to not follow typical Markdown behavior in this regard. As explained in their documentation:
A paragraph is simply one or more consecutive lines of text. In
markdown source code, paragraphs are separated by two or more blank
lines. In Typora, you only need one blank line (press Return once)
to create a new paragraph.
Press Shift + Return to create a single line break. Most other
markdown parsers will ignore single line breaks, so in order to make
other markdown parsers recognize your line break, you can leave two
spaces at the end of the line, or insert <br/>.

Related

How to paste multiline text in pycharm?

Everytime i try to copy and paste something on my Pycharm editor it all paste it in single line. How to automatically paste in multiline?[1]
This is what i copied.....
[{"DateObserved":"2020-06-12 ","HourObserved":23,"LocalTimeZone":"EST","ReportingArea":"Central New York Region","StateCode":"NY","Latitude":42.8049,"Longitude":-76.3589,"ParameterName":"O3","AQI":35,"Category":{"Number":1,"Name":"Good"}},{"DateObserved":"2020-06-12 ","HourObserved":23,"LocalTimeZone":"EST","ReportingArea":"Central New York Region","StateCode":"NY","Latitude":42.8049,"Longitude":-76.3589,"ParameterName":"PM2.5","AQI":0,"Category":{"Number":1,"Name":"Good"}}]
and this all got pasted in a single line on my Pycharm editor. can anybody help with that, its pretty hard to read all this info on a single line?
It seems like you didn't copy anything containing newlines as you can see better after my edit (See the side-by-side-markdown diff so you can see that I didn't remove any line breaks).
If you just copy everything as a single line, PyCharm won't be able to split it into multiple lines (except with auto-format maybe).
As you haven't said how you copied the input, I can't say what exactly is wrong.
However, it seems like you copied something from a program that didn't display the text correctly so that you couldn't copy it correctly.
Another possibility is that the IDE interprets line breaks differently.
For example, windows uses CRLF(carriage return+line feed) as a line seperator while linux uses LF only.
If your file contains only LF line breaks and PyCharm is configured to use CRLF like breaks, it is possible that it ignores them because of that.
You can change that behaviour at the bottom of your file in PyCharm (button with CR/CRLF/LF).

Indent first line of paragraph in Google Docs, but not under heading

Are there a way to, preferable automatically (rulewise), indent the first line of a paragraph in Google Docs but not doing that for text directly under a heading?
Example:
First heading
Here the line is not indented.
Here it is
here the text wraps down from its beginning "here it is".
Here too.
Second heading
Not indented.
But here.
I have seen that there is a way of doing this for all texts, headings included, but that is not what one would want - at least not when writing texts in my native swedish language.

Replace a blank before a table page break Word VBA

I uncheck "Allow row to break across pages" for a table's properties So, the table is shown on a new page to ensure that all the content is on one page, this works fine. But Word generates a blank space before the page break, I need to replace it with some text for a legal reason. I can't use a watermark or shapes because un Oracle BI Publisher only prints it on PDF and I need to export it to a docx.
The data is dynamic, so sometimes the text before the table and the text inside the table may change.
Current Version https://imgur.com/a/FTx0q
I need some like this https://imgur.com/a/ySitL
MS Office support told me that it can't be done with Word...
Maybe with VBA code?
Update
Thanks Cindy for your help.
I have a table into another table many paragraphs, checkbox etc and they are fitting on a new page. It's working.
I understand there isn't a page break.
It's Paragraph mark.
But what I need to do is insert a kind of mark, a text like XXXX,-----------, Instead of leaving "free space",
It's a requirement not change the font size or another text format.
For a legal requirement, some paragraph must fit on a new page and "blank spaces" replaced by a kind of mark.
I can't hard code it because in several cases not all the paragraphs or section in a page will be shown and I don't know by default when a new page is needed.
I am available to use macros or anything.
What you could do is insert a page-size table into a textbox in the page header and format the body text with a white background. The table will thus be hidden behind any text on the page, but not otherwise (provided you don't pad unused space with empty paragraphs, etc.).

Word.Range : Move Range index in the formatted text that corresponds to the plain text

I need to analyze text of my Word document, and create bookmarks on range of text my analyzer has detected (almost like a grammar checker).
I don't want use Find() utility, because my needs are too specific.
Explanations
For that,
1/ Retrieve Document plain text
I Retrieve Plain text of the main story of my document :
String plainText = ActiveDocument.Range().Text;
2/ Analyze plain text and get results
I send it to my analyzer tool which return a collection of marker with position :
For example, if I wanted to detected the pattern "my pattern" in the document text, analyzer could return a marker as { pattern : "my marker", start: 5, end : 14 }, where "start" and "end" are the character indexes of the pattern in the plain text sent.
3/ Display results in Document
I create bookmark from theses markers
For previously example, it woold be :
// init a new range and collapse it
Word.Range range = activeDocument.Range(); range.Collapse(WdCollapseStart);
// move character-by-character in the "formatted" text
range.MoveStart(WdUnits.Character, Marker.start ); # Marker.start=5
//set length (end)
range.setRange(range.Start,range.Start+(Marker.End-Marker.Start)); #Marker.end=14
4/ Results
4.1 Global Result
Everything is OK when Document Main Story Contains Text, links, lists, titles :
Ranges are well positionned, Plain Text indexes correlate with formatted text indexes.
4.2 Arrays Issue
When a document contains an array, Ranges are bad positionned a few characters : Plain Text indexes correlate not exactly with formatted text indexes.
I found the reason of this issue (It was explained in others forums) : this is due to non printing char(7), which is a cell delimiter added in plain text. We can handle these chars to calculate position range and everything is OK !
4.3 Issue for Content Controls, Table of contents, Sections and others
When a document contains theses elements, Ranges are also bad positionned a few characters.
Others non printing appears in plain text but I don't understand what it means and how deal with to calculate position range.
By displaying Word element markers with "Developer ribbon > creation mode", we see 2 markers per elements : shifting plain text indexes by 2*elements resolve issues. It's seems OK.
4.4 Issue with Endpaper
I don't know how we says "page de garde" (french) in english, I think it's "endpaper" : this is the first page with specific header, footer and content controls :)
When a document contains an Endpaper, Ranges are also bad positionned a few characters.
But this time, there are not non printing marker in the plain text.
Other info, when I display word element markers with "Developer ribbon > creation mode", I see endpaper markers.
Questions
How detect Endpaper in Word Document Range ?
How understand Plain Text indexes don't always correlate with formatted text indexes, in function of Word document elements which contains ?
XML nodes manipulation would be a more reliable alternative for that? If yes, could you give me good examples to manage bookmars or others in current document with XML Api ?
Others ressources
I found similar issues :
Correlate Range.Text to Range.Start and Range.End
http://www.vbaexpress.com/forum/showthread.php?36710-Strange-character-on-table-range-text
I hope my explanations are clear and you can help me to understand what is wrong or show me a best way to do that ?
Thanks, really.
It's not really pretty but you can try to remove the unwanted characters by Regex. For example to remove the \a letters (it has code 7):
string j = new string(new char[] { (char)7 });
plainText = Regex.Replace(plainText,string.Format("[{0}]", j), "");
Now you have to identify the other 'evil' characters and add them to the char array. If it works you will get a string whose length corresponds with the number of Characters in your document. Probably you have to adapt this code by experimenting. (I was not sure which language you are using - I supposed C#.)
Update
Another idea (if it is applicable to your analyzer tool):
Break your problem down to single paragraphs:
foreach(Word.Paragraph pg in activeDocument.Paragraphs)
{
Word.Range range = pg.Range();
string text = range.Text;
// your stuff here
}
With this paragraph range objects and the contained text strings you do the same as you tried to do with the whole document object and its text - just paragraph by paragraph. All these paragraphs are 'addressable' by ranges and Move operations as you already do it. I suppose that the problematic characters are outside or at the end of the paragraphs so they don't influence the character counting inside these paragraphs.
As I can't reproduce what you call endpaper I can't validate it. Besides I don't know if special text ranges as page headers and tables of content are covered by paragraphs. But at least you can reduce your problem to smaller ranges. I think it is worth trying.

automating word 2010 to generate docs

the webapp was already done on office2007 and i need to convert it so it'll work in office2010.
i was able to convert the header generator part of the code but i have problem with the body of the doc itself. the code copy the data from a "data" doc and paste it into the generated doc.
appword.activewindow.activepane.view.seekview = 0
'set appsel1 = appword.activewindow.selection
set appsel1 = appword.window(filepath).selection -that is the original one
appdoc1.bookmarks("b1").select
appword.selection.insertafter("some text")
appsel1.endkey(6) -the code stops here
appword.selection.insertafter("some other text")
the iexplorer debuger says ERROR:appsel1 object required. and when i view its data using the iexplorer debugger its data is "empty" instead of "{...}"
can anyone tell me what i'm doing wrong
if you need more of the code tell me.
From MSDN
After this method is applied, the selection expands to include the new
text.
If you use this method with a selection that refers to an entire
paragraph, the text is inserted after the ending paragraph mark (the
text will appear at the beginning of the next paragraph). To insert
text at the end of a paragraph, determine the ending point and
subtract 1 from this location (the paragraph mark is one character).
However, if the selection ends with a paragraph mark that also happens
to be the end of the document, Microsoft Word inserts the text before
the final paragraph mark rather than creating a new paragraph at the
end of the document.
Also, if the selection is a bookmark, Word inserts the specified
text but does not extend the selection or the bookmark to include the
new text.
So I suspect that you still have no selected text.
I wonder if you can do a Selection Collapse(wdCollapseStart) but that's just a thought.