New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using "{% pullquote %}" inside "{% blockquote %}", Hexo will create a extra <br /> between <p> #2204

Closed
vamworks opened this Issue Oct 9, 2016 · 4 comments

Comments

3 participants
@vamworks

vamworks commented Oct 9, 2016

before you submit your issue, please delete all the example code in template

Environment Info

Node version(node -v)

v6.6.0

Your site _config.yml

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: VamWorks
subtitle:
description:
author: Vam Zhang
language:
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://vamworks.com
root: /
permalink: :year/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape

# add caption for iamges
image_caption:
  enable: true #false to disable
  class_name: #if you wanna customize the style for the caption,you can assign a class name, default is 'image-caption'

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: aws-s3
  bucket: vamworks.com
  region: ap-northeast-2

Your theme _config.yml

# Hexo Configuration
# Header
menu:
  Home: /
  Archives: /archives
rss: /atom.xml

# Content
excerpt_link: Read More
fancybox: true

# Sidebar
sidebar: right
widgets:
- category
- tag
- tagcloud
- archive
- recent_posts

# display widgets at the bottom of index pages (pagination == 2)
index_widgets:
# - category
# - tagcloud
# - archive

# widget behavior
archive_type: 'monthly'
show_count: false

# Miscellaneous
google_analytics:
favicon: /favicon.png
twitter:
google_plus:
fb_admins:
fb_app_id:

Plugin version(npm ls --depth 0)

hexo-site@0.0.0 /Zhang/Vam/Website/vamworks.github.io
├── hexo@3.2.2
├── hexo-deployer-aws-s3@0.1.1
├── hexo-deployer-ftpsync@0.1.1
├── hexo-deployer-git@0.2.0
├── UNMET DEPENDENCY hexo-deployer-s3@^0.2.0
├── hexo-generator-archive@0.1.4
├── hexo-generator-category@0.1.3
├── hexo-generator-index@0.2.0
├── hexo-generator-tag@0.2.0
├── hexo-image-caption@0.1.1
├── hexo-renderer-ejs@0.2.0
├── hexo-renderer-marked@0.2.11
├── hexo-renderer-stylus@0.3.1
└── hexo-server@0.2.0

For BUG

  • BUG description: When using "{% pullquote %}" inside "{% blockquote %}", Hexo will create a extra
    between

    . It is normal when using "{% pullquote %}" directly.

@Neveryu

This comment has been minimized.

Show comment
Hide comment
@Neveryu

Neveryu Oct 13, 2016

@vamworks
So regretful !
using {% pullquote %} right way is :
{% pullquote [class] %}
content
{% endpullquote %}
Feedback

Neveryu commented Oct 13, 2016

@vamworks
So regretful !
using {% pullquote %} right way is :
{% pullquote [class] %}
content
{% endpullquote %}
Feedback

@vamworks

This comment has been minimized.

Show comment
Hide comment
@vamworks

vamworks Oct 13, 2016

@Neveryu

I mean when I use pull quote in following way:

{% blockquote %}
content
{% pullquote [class] %}
content
{% endpullquote %}
content
{% endblockquote %}

It will generate many extra
.

Blockquote could have pullquote. I think it makes sense.

vamworks commented Oct 13, 2016

@Neveryu

I mean when I use pull quote in following way:

{% blockquote %}
content
{% pullquote [class] %}
content
{% endpullquote %}
content
{% endblockquote %}

It will generate many extra
.

Blockquote could have pullquote. I think it makes sense.

@seaoak

This comment has been minimized.

Show comment
Hide comment
@seaoak

seaoak Dec 19, 2016

Member

I am trying to improve Hexo to allow nested "blockquote" tag plugin.
In that process, I found three problems.
I think this issue is related to two of them.

  1. The generated HTML code of inner pullquote block is rendered once more.
    So the "hard breaks" process is executed twice.
    As a result, a newline character in the result of the inner block is
    translated to a <br> element.
    This is why extra <br> elements are created in inner pullquote block.
    One way to resolve this problem is to remove all newline characters
    from the result of inner pullquote block.
    But I'm not sure about safety/compatibility (in fact, some tests are broken).

  2. A pullquote starting tag requires an empty line immediately before it.
    This problem is not only nested block tag.
    It is the same when using {% pullquote %} directly.
    If you violate this requirement, a malformed HTML code is generated
    such as <p>aaa<blockquote><p>bbb</p></blockquote>ccc</p>.
    One way to resolve this problem is to insert a newline character automatically
    before rendering the markdown around it.
    But I'm not sure about safety/compatibility (in fact, some tests are broken).

  3. (FYI) When a block tag plugin is located inside the same block tag plugin,
    Hexo can not parse it correctly.
    I already have a patch for this problem, so I will make a pull request.

By the way, a <blockquote> element can contain <blockquote> elements
because a <blockquote> element is a "Flow content" in itself:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote

Right you are, @vamworks :-)

Member

seaoak commented Dec 19, 2016

I am trying to improve Hexo to allow nested "blockquote" tag plugin.
In that process, I found three problems.
I think this issue is related to two of them.

  1. The generated HTML code of inner pullquote block is rendered once more.
    So the "hard breaks" process is executed twice.
    As a result, a newline character in the result of the inner block is
    translated to a <br> element.
    This is why extra <br> elements are created in inner pullquote block.
    One way to resolve this problem is to remove all newline characters
    from the result of inner pullquote block.
    But I'm not sure about safety/compatibility (in fact, some tests are broken).

  2. A pullquote starting tag requires an empty line immediately before it.
    This problem is not only nested block tag.
    It is the same when using {% pullquote %} directly.
    If you violate this requirement, a malformed HTML code is generated
    such as <p>aaa<blockquote><p>bbb</p></blockquote>ccc</p>.
    One way to resolve this problem is to insert a newline character automatically
    before rendering the markdown around it.
    But I'm not sure about safety/compatibility (in fact, some tests are broken).

  3. (FYI) When a block tag plugin is located inside the same block tag plugin,
    Hexo can not parse it correctly.
    I already have a patch for this problem, so I will make a pull request.

By the way, a <blockquote> element can contain <blockquote> elements
because a <blockquote> element is a "Flow content" in itself:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote

Right you are, @vamworks :-)

@stale stale bot added the wontfix label Sep 27, 2017

@stale

This comment has been minimized.

Show comment
Hide comment
@stale

stale bot Nov 26, 2017

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale bot commented Nov 26, 2017

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 26, 2017

@stale stale bot closed this Dec 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment