使用 Markdown 语法引用块引用的作者

发布于 2024-08-16 09:22:40 字数 363 浏览 10 评论 0原文

我正在使用 Symfony CMS,它使用 Markdown 进行文章写作。我需要对 本杰明·富兰克林 的引言进行块引用,并希望在引言后面加上它下面有一个引用,但现在它所做的只是对整行进行块引用。如何在 Markdown 语法中做到这一点?

I am using the Symfony CMS and it uses Markdown for article writing. I need to do a blockquote of a quote from Benjamin Franklin and would like to have the quote followed by a citation beneath it, but right now all it does is blockquote the whole line. How does one do this in markdown syntax?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

凉世弥音 2024-08-23 09:22:41

此处添加另一个示例以供参考。 自 https://en.wikipedia.org/wiki/Special:CiteThisPage

> Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. 
>
> --- [Test-driven development. (2016, November 20). In Wikipedia, The Free Encyclopedia. Retrieved 23:45, November 20, 2016](https://en.wikipedia.org/w/index.php?title=Test-driven_development&oldid=750634597)

生成 下列的:

测试驱动开发(TDD)是一种依赖于重复非常短的开发周期的软件开发过程:将需求转化为非常具体的测试用例,然后改进软件以仅通过新的测试。

--- 测试驱动开发。 (2016 年 11 月 20 日)。在维基百科,免费百科全书。检索于 2016 年 11 月 20 日 23:45

Adding another sample here for reference. Generated from https://en.wikipedia.org/wiki/Special:CiteThisPage

> Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. 
>
> --- [Test-driven development. (2016, November 20). In Wikipedia, The Free Encyclopedia. Retrieved 23:45, November 20, 2016](https://en.wikipedia.org/w/index.php?title=Test-driven_development&oldid=750634597)

Produces the following:

Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only.

--- Test-driven development. (2016, November 20). In Wikipedia, The Free Encyclopedia. Retrieved 23:45, November 20, 2016

远昼 2024-08-23 09:22:41

此页面上的每个纯 Markdown 答案都会在引用和引文之间添加一行:

看起来像这样。

—0x263a

或者他们这样做:

类似这样的事情。
— 0x263a

但是,如果您不想要额外的换行符并且希望引文与引用出现在单独的行上:

“像这样。”
— 0x263a

您可以在报价末尾添加 \

> "Quote."\
> — <cite>Author<cite>

Every pure markdown answer on this page adds a line between the quote and the citation:

Which looks something like this.

— 0x263a

Or they do:

Something like this.
— 0x263a

But if you don't want that extra newline and you want the citation to appear on a separate line from the quote:

"Like this."
— 0x263a

You can add a \ to the end of your quote.

> "Quote."\
> — <cite>Author<cite>
冷血 2024-08-23 09:22:41

1.因为任何引用都应该有来源,即使它是未知的。

2.自从降价以来
<代码>> Quote 呈现为

Quote

> Quote1
>
> Quote2

呈现为

<blockquote>
  <p>Quote1</p>
  <p>Quote2</p>
</blockquote>

我对此的解决方案始终采用最后一个 < ;p>

作为源并通过 css 处理它(在我的例子中是 SCSS):

blockquote {
    p {
        display: inline;

        &:first-of-type {
            quotes: '\201C' '\201D' '\2018' '\2019';

            &::before {
                content: open-quote;
                margin-right: 0.1rem;
            }
        }

        &:last-of-type {
            quotes: '\201C' '\201D' '\2018' '\2019';
            font-style: italic;

            &::before {
                content: close-quote "\000A" "\2014" " ";
                white-space: pre;
                margin-left: 0.1rem;
                font-style: normal;
            }
        }

        // In case of a quote without a source.
        &:only-of-type {
            font-style: normal;
            quotes: '\201C' '\201D' '\2018' '\2019';

            &::before {
               content: open-quote;
               margin-right: 0.1rem;
            }

            &::after {
                content: close-quote;
                margin-left: 0.1rem;
            }
        }
    }
}

\000A 它是 换行unicode字符css格式,它有助于使源出现在下一行,如果你不想,只需将其删除并在那里添加一些空格。其他的也是unicode字符css格式。

1. Since any quote it is suppose to have a source, even if it is unknown.

2. Since a markdown
> Quote is rendered as <blockquote><p>Quote</p></blockquote> and

> Quote1
>
> Quote2

is rendered as

<blockquote>
  <p>Quote1</p>
  <p>Quote2</p>
</blockquote>

My solution to this is always take the last <p></p> as source and handle it by css (in my case SCSS):

blockquote {
    p {
        display: inline;

        &:first-of-type {
            quotes: '\201C' '\201D' '\2018' '\2019';

            &::before {
                content: open-quote;
                margin-right: 0.1rem;
            }
        }

        &:last-of-type {
            quotes: '\201C' '\201D' '\2018' '\2019';
            font-style: italic;

            &::before {
                content: close-quote "\000A" "\2014" " ";
                white-space: pre;
                margin-left: 0.1rem;
                font-style: normal;
            }
        }

        // In case of a quote without a source.
        &:only-of-type {
            font-style: normal;
            quotes: '\201C' '\201D' '\2018' '\2019';

            &::before {
               content: open-quote;
               margin-right: 0.1rem;
            }

            &::after {
                content: close-quote;
                margin-left: 0.1rem;
            }
        }
    }
}

The \000A it the new line unicode character css format, it help to make the source in appear in the next line, if you don't want, just remove it and add some spaces there. The others are also unicode character css format.

金兰素衣 2024-08-23 09:22:41

就我个人而言,我更喜欢在块引用中嵌套块引用。

我喜欢这样做:

> Quote here.
>
>> <cite>Benjamin Franklin</cite>

输出取决于你如何设计所有内容,但使用普通的 ol github 看起来像这样,我个人认为看起来很棒!

在此处输入图像描述

https://gist.github.com/nahtnam/63e3a14acd0f02313ec0

Personally I prefer nesting a blockquote in a blockquote.

Here is how I like doing it:

> Quote here.
>
>> <cite>Benjamin Franklin</cite>

The output varies on how you style everything, but using plain `ol github look like this, which I personally think looks great!

enter image description here

https://gist.github.com/nahtnam/63e3a14acd0f02313ec0

太傻旳人生 2024-08-23 09:22:40

Markdown 没有专用的引用语法。

你最好的选择是这样的:

> Quote here.
>
> -- <cite>Benjamin Franklin</cite>

结果是:

此处引用。

--本杰明·富兰克林

Markdown has no dedicated citation syntax.

Your best bet is something like this:

> Quote here.
>
> -- <cite>Benjamin Franklin</cite>

which results in:

Quote here.

-- Benjamin Franklin

岁吢 2024-08-23 09:22:40
> The secret to creativity is knowing how to hide your sources. 
> -- <cite>[Albert Einstein][1]</cite>

[1]: http://www.quotedb.com/quotes/2112

如果您有样式手册,请使用其指南来确定引用的确切位置等。

Markdown + Smartypants 对于上述内容是

创造力的秘密是知道如何隐藏你的资源。
-- 阿尔伯特·爱因斯坦

> The secret to creativity is knowing how to hide your sources. 
> -- <cite>[Albert Einstein][1]</cite>

[1]: http://www.quotedb.com/quotes/2112

If you have a style manual, use its guidelines to determine exactly where to place the citation, etc.

Output of Markdown + Smartypants for the above is

The secret to creativity is knowing how to hide your sources.
-- Albert Einstein

桃扇骨 2024-08-23 09:22:40
> Quote

— Benjamin Franklin

根据HTML Living Standard,引用的出处必须放在块引用之外 元素。

引用的归属(如果有)必须放置在 blockquote 元素之外。

HTML 标准:4.4.4。 blockquote 元素

请注意,cite 元素表示作品的标题,不得用于标记人名。有关更多详细信息,请查看 HTML 标准:4.5.6 cite 元素

通常使用破折号 (U+2014) 来代替连字符。许多 Markdown 解析器支持 Unicode,这意味着您可以直接编写破折号,而不是使用 HTML 实体。直接编写这些字符可以提高可读性,更多工具会知道您想要什么而不会惊慌,并且您的文档可能会更容易移植,因为您不会将自己束缚于 HTML。

> Quote

— Benjamin Franklin

According to the HTML Living Standard, attribution for the quotation must be placed outside the blockquote element.

Attribution for the quotation, if any, must be placed outside the blockquote element.

HTML Standard: 4.4.4. The blockquote element

Note that the cite element represents the title of the work and must not be used to mark up people's names. For more detail check out HTML Standard: 4.5.6 The cite element.

Instead of the hyphen, it is common to use the em dash (U+2014). Many Markdown parsers support Unicode, which means you can write the em dash directly, instead of using HTML entities. Writing such characters directly improves readability, more tools will know what you want and not panic, and your document might be more portable as you are not bounding yourself to HTML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文